Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 99971d7
  • /
  • example.cpp
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:97cefeb815ba439f8b393e2e961136ceb14f47af
directory badge
swh:1:dir:99971d799fcef81bbd81a6e21a8fc9a739bb29e8

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
example.cpp
/*!
 * \file OxCalculatorT1Shmolli_test.cpp
 * \author Konrad Werys
 * \date 2018/08/02
 */

#include "CmakeConfigForTomato.h"

#include "gtest/gtest.h"

#ifdef USE_PRIVATE_NR2
#include "OxCalculatorT1Shmolli.h"
#include "OxFunctionsT1Shmolli.h"
#include "OxFitterAmoebaPrivateNr2.h"
#include "OxSignCalculatorShmolli.h"
#include "OxStartPointCalculatorShmolli.h"

//#ifdef USE_VNL
//#include "OxSignCalculatorNoSign.h"
//#include "OxFunctionsT1ThreeParams.h"
//#include "OxFitterAmoebaVnl.h"
//#include "OxFitterLevenbergMarquardtVnl.h"
//#include "OxSignCalculatorRealImag.h"
//#include "OxStartPointCalculatorDefault3Dims.h"

Ox::CalculatorT1Results<double> CalculateShmolli(
        int nSamples, double* sigMag, double* sigPha, double* invTimes) {

    // initialise the necessary objects
    Ox::CalculatorT1Shmolli <double> calculatorT1Shmolli;
    Ox::FunctionsT1Shmolli <double> functionsObject;
    Ox::FitterAmoebaPrivateNr2 <double> fitter;
    Ox::SignCalculatorShmolli <double> signCalculator;
    Ox::StartPointCalculatorShmolli <double> startPointCalculator;

    // configure
    calculatorT1Shmolli.setFunctionsT1(&functionsObject);
    calculatorT1Shmolli.setFitter(&fitter);
    calculatorT1Shmolli.setSignCalculator(&signCalculator);
    calculatorT1Shmolli.setStartPointCalculator(&startPointCalculator);

    // set the data
    calculatorT1Shmolli.setNSamples(nSamples);
    calculatorT1Shmolli.setInvTimes(invTimes);
    calculatorT1Shmolli.setSigMag(sigMag);
    calculatorT1Shmolli.setSigPha(sigPha);

    calculatorT1Shmolli.calculate();

    return calculatorT1Shmolli.getResults();
}

TEST(OxCalculatorT1Shmolli, calculate_anything) {
    int nSamples = 7;
    double sigMag[7] = {49,   40,   26,   42,   59,   62,   63};
    double sigPha[7] = {3918, 3560, 3587, -809, -729, -784, -795};
    double invTimes[7] = {100,  180,  260, 1715, 3337, 4907, 6455};

    Ox::CalculatorT1Results<double> results = CalculateShmolli(nSamples, sigMag, sigPha, invTimes);

    //results.disp();

    EXPECT_NE(results.T1, 0);
}

//#endif // USE_VNL
#endif // USE_PRIVATE_NR2

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API