Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xData_2d_xindex_y.cc File Reference
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include "xData.h"

Go to the source code of this file.

Functions

int xData_init_2d_xindex_y (statusMessageReporting *smr, xData_element *element)
 
int xData_is_2d_xindex_y (statusMessageReporting *smr, xDataType *xDT, int setMsg)
 
int xData_isElement_2d_xindex_y (statusMessageReporting *smr, xData_element *element, int setMsg)
 
xData_IntxData_2d_xindex_y_rawIndices (statusMessageReporting *smr, xData_element *element)
 
int xData_2d_xindex_y_free_rawIndices (statusMessageReporting *smr, void *data)
 
double * xData_2d_xindex_y_toXYs (statusMessageReporting *smr, xData_element *element, double *Xs)
 
double * xData_2d_xindex_y_toFilledYs (statusMessageReporting *smr, xData_element *element, double *Xs)
 
int xData_2d_xindex_y_free_toFilledYs (statusMessageReporting *smr, void *data)
 
double * xData_2d_xindex_y_toFilledXYs (statusMessageReporting *smr, xData_element *element, double *Xs)
 

Function Documentation

◆ xData_2d_xindex_y_free_rawIndices()

int xData_2d_xindex_y_free_rawIndices ( statusMessageReporting smr,
void *  data 
)

Definition at line 170 of file xData_2d_xindex_y.cc.

170 {
171
172 xData_free( smr, data );
173 return( 0 );
174}
void * xData_free(statusMessageReporting *smr, void *p)
Definition: xDataMisc.cc:89

◆ xData_2d_xindex_y_free_toFilledYs()

int xData_2d_xindex_y_free_toFilledYs ( statusMessageReporting smr,
void *  data 
)

Definition at line 209 of file xData_2d_xindex_y.cc.

209 {
210
211 xData_free( smr, data );
212 return( 0 );
213}

◆ xData_2d_xindex_y_rawIndices()

xData_Int * xData_2d_xindex_y_rawIndices ( statusMessageReporting smr,
xData_element element 
)

Definition at line 150 of file xData_2d_xindex_y.cc.

150 {
151/*
152* Returns NULL if length is 0 or memory could not be allocated.
153*/
154 xDataType *xDT = &(element->xDataTypeInfo);
155 xData_Int i, index = xDT->start, *values;
157
158 if( xDT->length == 0 ) return( NULL );
159 //if( ( values = xData_malloc2( smr, xDT->length * sizeof( xData_Int ), 0, "values" ) ) == NULL ) return( NULL );
160 if( ( values = (xData_Int*) xData_malloc2( smr, xDT->length * sizeof( xData_Int ), 0, "values" ) ) == NULL ) return( NULL );
161 for( i = 0; i < xDT->length; i++ ) {
162 values[i] = index;
163 index += data[i].index;
164 }
165 return( values );
166}
xData_Int length
Definition: xData.h:162
xData_Int start
Definition: xData.h:162
void * data
Definition: xData.h:163
xData_Int index
Definition: xData.h:102
xDataType xDataTypeInfo
Definition: xData.h:187
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313
int xData_Int
Definition: xData.h:50

◆ xData_2d_xindex_y_toFilledXYs()

double * xData_2d_xindex_y_toFilledXYs ( statusMessageReporting smr,
xData_element element,
double *  Xs 
)

Definition at line 217 of file xData_2d_xindex_y.cc.

217 {
218
219 return( xData_2d_xindex_y_toFilled( smr, element, Xs, 2 ) );
220}

◆ xData_2d_xindex_y_toFilledYs()

double * xData_2d_xindex_y_toFilledYs ( statusMessageReporting smr,
xData_element element,
double *  Xs 
)

Definition at line 202 of file xData_2d_xindex_y.cc.

202 {
203
204 return( xData_2d_xindex_y_toFilled( smr, element, Xs, 1 ) );
205}

Referenced by tpia_misc_get2dxindex_y_data().

◆ xData_2d_xindex_y_toXYs()

double * xData_2d_xindex_y_toXYs ( statusMessageReporting smr,
xData_element element,
double *  Xs 
)

Definition at line 178 of file xData_2d_xindex_y.cc.

178 {
179/*
180* Returns NULL if length is 0 or memory could not be allocated.
181*/
182 xDataType *xDT = &(element->xDataTypeInfo);
183 xData_Int i, index = xDT->start;
184 double *values = NULL, *p;
186
187 if( xDT->length == 0 ) return( NULL );
188 //if( ( values = xData_malloc2( smr, 2 * xDT->length * sizeof( double ), 0, "values" ) ) == NULL ) return( NULL );
189 if( ( values = (double*) xData_malloc2( smr, 2 * xDT->length * sizeof( double ), 0, "values" ) ) == NULL ) return( NULL );
190 p = values;
191 for( i = 0; i < xDT->length; i++, p++ ) {
192 index += data[i].index;
193 *p = Xs[index];
194 p++;
195 *p = data[i].value;
196 }
197 return( values );
198}

◆ xData_init_2d_xindex_y()

int xData_init_2d_xindex_y ( statusMessageReporting smr,
xData_element element 
)

Definition at line 55 of file xData_2d_xindex_y.cc.

55 {
56
57 xDataType *xDT = &(element->xDataTypeInfo);
58
61 xDT->element = element;
62 xDT->toData = toData;
63 xDT->toString = toString;
64 xDT->release = release;
65 xDT->data = NULL;
66 return( xData_xDataTypeConvertAttributes( smr, element ) );
67}
xData_element * element
Definition: xData.h:157
enum xData_xDataType status
Definition: xData.h:155
xDT_releaseFunction release
Definition: xData.h:160
const char * typeString
Definition: xData.h:156
xDT_toStringFunction toString
Definition: xData.h:159
xDT_toDataFunction toData
Definition: xData.h:158
char const *const xData_twod_xindex_y_ID
Definition: xData.h:73
int xData_xDataTypeConvertAttributes(statusMessageReporting *smr, xData_element *element)
Definition: xData.cc:668
@ xData_xDataType_Ok
Definition: xData.h:81

◆ xData_is_2d_xindex_y()

int xData_is_2d_xindex_y ( statusMessageReporting smr,
xDataType xDT,
int  setMsg 
)

Definition at line 71 of file xData_2d_xindex_y.cc.

71 {
72
73 return( xData_is_xDataType( smr, xDT, xData_twod_xindex_y_ID, setMsg ) );
74}
int xData_is_xDataType(statusMessageReporting *smr, xDataType *xDT, char const *const type, int setMsg)
Definition: xData.cc:900

Referenced by tpia_misc_get2dxindex_y_data(), and xData_isElement_2d_xindex_y().

◆ xData_isElement_2d_xindex_y()

int xData_isElement_2d_xindex_y ( statusMessageReporting smr,
xData_element element,
int  setMsg 
)

Definition at line 78 of file xData_2d_xindex_y.cc.

78 {
79
80 return( xData_is_2d_xindex_y( smr, &(element->xDataTypeInfo), setMsg ) );
81}
int xData_is_2d_xindex_y(statusMessageReporting *smr, xDataType *xDT, int setMsg)