<commit_before>#ifndef NCFULLAPIFUNCTIONS_H
#define NCFULLAPIFUNCTIONS_H

#include "ncDataReader2.h"

#define FILENAME "../examples/testfilebig.nc"

/* dataset and variable information */
static NcDataSet1D *dset = NULL;
static NcVar1D *v1, *v2;

/* initialization function */
static void myInit(const char* fileName) {
    dset = ncDataSet1DNew(fileName, "time", EpPeriodic, LtFull, 10);

    v1 = ncVar1DNew(dset, "big_var_01", IpAkima, LtChunk);
    ncVar1DSetOption(v1, OpVarParameterCacheSize, 10);
    ncVar1DSetOption(v1, OpVarChunkSize, 100);

    v2 = ncVar1DNew(dset, "big_var_03", IpSinSteps, LtChunk);
    ncVar1DSetOption(v2, OpVarSmoothing, 0.001);
    ncVar1DSetOption(v2, OpVarChunkSize, 100);
}

/* functions to return the interpolated values -
 * myInit() is executed at the first call to one of the functions */

double getV1(const char* fileName, double x){
    if (dset == NULL)
        myInit(fileName);
    return ncVar1DGet(v1, x);
};

double getV2(const char* fileName, double x){
    if (dset == NULL)
        myInit(fileName);
    return ncVar1DGet(v2, x);
};


/* just a simple main routine to test the functions standalone,
 * not needed for Modelica */

#ifdef TEST_ME
#include <stdio.h>

int main(void) {
    double t = 42.0;
    printf("%g\t%g\t%g\n", t, getV1(FILENAME, t), getV2(FILENAME, t));<commit_msg>Update FullAPIFunctions.h<commit_after>#ifndef NCFULLAPIFUNCTIONS_H
#define NCFULLAPIFUNCTIONS_H

#include "ncDataReader2.h"

#define FILENAME "../examples/testfilebig.nc"

/* dataset and variable information */
static NcDataSet1D *dset = NULL;
static NcVar1D *v1, *v2;

/* initialization function */
static void myInit(const char* fileName) {
    dset = ncDataSet1DNew(fileName, "time", EpPeriodic, LtFull, 10);

    v1 = ncVar1DNew(dset, "big_var_01", IpAkima, LtChunk);
    ncVar1DSetOption(v1, OpVarParameterCacheSize, 10);
    ncVar1DSetOption(v1, OpVarChunkSize, 100);

    v2 = ncVar1DNew(dset, "big_var_03", IpSinSteps, LtChunk);
    ncVar1DSetOption(v2, OpVarSmoothing, 0.001);
    ncVar1DSetOption(v2, OpVarChunkSize, 100);
}

/* functions to return the interpolated values -
 * myInit() is executed at the first call to one of the functions */

double getV1(const char* fileName, double x) {
    if (dset == NULL)
        myInit(fileName);
    return ncVar1DGet(v1, x);
}

double getV2(const char* fileName, double x) {
    if (dset == NULL)
        myInit(fileName);
    return ncVar1DGet(v2, x);
}

/* just a simple main routine to test the functions standalone,
 * not needed for Modelica */

#ifdef TEST_ME
#include <stdio.h>

int main(void) {
    double t = 42.0;
    printf("%g\t%g\t%g\n", t, getV1(FILENAME, t), getV2(FILENAME, t));
{'fraction_non_alphanumeric': 0.12383785793975456, 'fraction_numerical': 0.03495723317218297, 'mean_word_length': 4.233463035019455, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '365581', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1015, 'n_words': 258}