Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xDataTOM_interpolation.cc File Reference
#include <string.h>
#include "xDataTOM_private.h"

Go to the source code of this file.

Macros

#define dependentAxis   1
 
#define allowByRegion   2
 

Functions

int xDataTOM_interpolation_set (statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier)
 
int xDataTOM_interpolation_setFromString (statusMessageReporting *smr, xDataTOM_interpolation *interpolation, char const *str)
 
int xDataTOM_interpolation_copy (statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src)
 

Macro Definition Documentation

◆ allowByRegion

#define allowByRegion   2

Definition at line 15 of file xDataTOM_interpolation.cc.

◆ dependentAxis

#define dependentAxis   1

Definition at line 14 of file xDataTOM_interpolation.cc.

Function Documentation

◆ xDataTOM_interpolation_copy()

int xDataTOM_interpolation_copy ( statusMessageReporting smr,
xDataTOM_interpolation desc,
xDataTOM_interpolation src 
)

Definition at line 102 of file xDataTOM_interpolation.cc.

102 {
103
104 return( xDataTOM_interpolation_set( smr, desc, src->independent, src->dependent, src->qualifier ) );
105}
enum xDataTOM_interpolationFlag independent dependent
Definition: xDataTOM.h:57
enum xDataTOM_interpolationQualifier qualifier
Definition: xDataTOM.h:58
int xDataTOM_interpolation_set(statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier)

Referenced by xDataTOM_axis_initialize(), and xDataTOM_subAxes_initialize().

◆ xDataTOM_interpolation_set()

int xDataTOM_interpolation_set ( statusMessageReporting smr,
xDataTOM_interpolation interpolation,
enum xDataTOM_interpolationFlag  independent,
enum xDataTOM_interpolationFlag  dependent,
enum xDataTOM_interpolationQualifier  qualifier 
)

Definition at line 22 of file xDataTOM_interpolation.cc.

23 {
24
25 if( ( independent < xDataTOM_interpolationFlag_linear ) || ( independent > xDataTOM_interpolationFlag_byRegion ) ) {
26 smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid independent interpolation = %d", independent );
27 return( 1 );
28 }
29 if( ( dependent < xDataTOM_interpolationFlag_linear ) || ( dependent > xDataTOM_interpolationFlag_flat ) ) {
30 smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid dependent interpolation = %d", dependent );
31 return( 1 );
32 }
34 smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid interpolation qualifier = %d", qualifier );
35 return( 1 );
36 }
37
38 interpolation->independent = independent;
39 interpolation->dependent = dependent;
40 interpolation->qualifier = qualifier;
41 return( 0 );
42}
#define smr_setReportError2(smr, libraryID, code, fmt,...)
@ xDataTOM_interpolationFlag_byRegion
Definition: xDataTOM.h:20
@ xDataTOM_interpolationFlag_linear
Definition: xDataTOM.h:19
@ xDataTOM_interpolationFlag_flat
Definition: xDataTOM.h:20
@ xDataTOM_interpolationQualifier_correspondingPoints
Definition: xDataTOM.h:22
@ xDataTOM_interpolationQualifier_invalid
Definition: xDataTOM.h:21
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34

Referenced by xDataTOM_interpolation_copy(), xDataTOM_interpolation_setFromString(), xDataTOM_subAxes_initialize(), and xDataXML_axesToTOM().

◆ xDataTOM_interpolation_setFromString()

int xDataTOM_interpolation_setFromString ( statusMessageReporting smr,
xDataTOM_interpolation interpolation,
char const *  str 
)

Definition at line 46 of file xDataTOM_interpolation.cc.

46 {
47
48 int flag = 0;
49 char const *c, *e;
51 enum xDataTOM_interpolationFlag independent, dependent;
52
53 if( ( c = strchr( str, ':' ) ) != NULL ) {
54 if( strncmp( "unitBase:", str, 9 ) == 0 ) {
56 else if( strncmp( "correspondingPoints:", str, 20 ) == 0 ) {
58 else {
59 smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid interpolation string qualifier '%s'", str );
60 return( 1 );
61 }
62 c++; }
63 else {
64 c = str;
65 }
66 if( ( independent = xDataTOM_interpolation_getFromString( smr, c, &e, str, flag ) ) == xDataTOM_interpolationFlag_invalid ) return( 1 );
67 if( *e != ',' ) {
68 smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "missing ',' separator in interpolation string'%s'", str );
69 return( 1 );
70 }
71 c = ++e;
72 flag |= dependentAxis;
73 if( ( dependent = xDataTOM_interpolation_getFromString( smr, c, &e, str, flag ) ) == xDataTOM_interpolationFlag_invalid ) return( 1 );
74 xDataTOM_interpolation_set( smr, interpolation, independent, dependent, qualifier );
75 return( 0 );
76}
xDataTOM_interpolationFlag
Definition: xDataTOM.h:19
@ xDataTOM_interpolationFlag_invalid
Definition: xDataTOM.h:19
xDataTOM_interpolationQualifier
Definition: xDataTOM.h:21
@ xDataTOM_interpolationQualifier_unitBase
Definition: xDataTOM.h:22
@ xDataTOM_interpolationQualifier_none
Definition: xDataTOM.h:22
#define dependentAxis

Referenced by xDataXML_axesToTOM().