Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xData_2d_xshared_yhistogram.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_xShared_yHistogram (statusMessageReporting *smr, xData_element *element)
 
int xData_is_2d_xShared_yHistogram (statusMessageReporting *smr, xDataType *xDT, int setMsg)
 
int xData_isElement_2d_xShared_yHistogram (statusMessageReporting *smr, xData_element *element, int setMsg)
 
double * xData_2d_xShared_yHistogram_copyData (statusMessageReporting *, xData_element *element, xData_Int *n)
 
int xData_2d_xShared_yHistogram_free_copyData (statusMessageReporting *smr, void *data)
 
double * xData_2d_xShared_yHistogram_toFilledXYs (xDataType *xDT, xData_Int nXs, double *Xs)
 

Function Documentation

◆ xData_2d_xShared_yHistogram_copyData()

double * xData_2d_xShared_yHistogram_copyData ( statusMessageReporting smr,
xData_element element,
xData_Int n 
)

Definition at line 85 of file xData_2d_xshared_yhistogram.cc.

85 {
86
87 xDataType *xDT = &(element->xDataTypeInfo);
88 xData_Int i;
89 double *p, *values, *d = (double *) xDT->data;
90
91 *n = xDT->end - xDT->start;
92 if( xDT->length == 0 ) return( NULL );
93 if( *n == 0 ) return( NULL );
94 //if(( values = xData_malloc2( NULL, *n * sizeof( double ), 0, "values" ) )) {
95 if(( values = (double*) xData_malloc2( NULL, *n * sizeof( double ), 0, "values" ) )) {
96 p = values;
97 for( i = 0; i < *n; i++, p++, d++ ) *p = *d;
98 }
99 return( values );
100}
xData_Int length
Definition: xData.h:162
xData_Int end
Definition: xData.h:162
xData_Int start
Definition: xData.h:162
void * data
Definition: xData.h:163
xDataType xDataTypeInfo
Definition: xData.h:187
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313
int xData_Int
Definition: xData.h:50

Referenced by tpia_misc_get2d_xShared_yHistogram_data().

◆ xData_2d_xShared_yHistogram_free_copyData()

int xData_2d_xShared_yHistogram_free_copyData ( statusMessageReporting smr,
void *  data 
)

Definition at line 104 of file xData_2d_xshared_yhistogram.cc.

104 {
105
106 xData_free( smr, data );
107 return( 0 );
108}
void * xData_free(statusMessageReporting *smr, void *p)
Definition: xDataMisc.cc:89

◆ xData_2d_xShared_yHistogram_toFilledXYs()

double * xData_2d_xShared_yHistogram_toFilledXYs ( xDataType xDT,
xData_Int  nXs,
double *  Xs 
)

Definition at line 164 of file xData_2d_xshared_yhistogram.cc.

164 {
165/*
166* Returns NULL if length is 0, memory could not be allocated, or nXs != xDT->length + 1.
167*/
168 xData_Int i;
169 //double *p, *values, *d = xDT->data;
170 double *p, *values, *d = (double*) xDT->data;
171
172 if( xDT->length == 0 ) return( NULL );
173 if( ( xDT->length + 1 ) != nXs ) return( NULL );
174 //if( ( values = xData_malloc2( NULL, 4 * xDT->length * sizeof( double ), 0, "values" ) ) == NULL ) return( NULL );
175 if( ( values = (double*) xData_malloc2( NULL, 4 * xDT->length * sizeof( double ), 0, "values" ) ) == NULL ) return( NULL );
176 p = values;
177 for( i = 0; i < xDT->length; i++ ) {
178 *(p++) = Xs[i];
179 *(p++) = 0.;
180 *(p++) = Xs[i+1];
181 *(p++) = 0.;
182 }
183 p = &(values[4 * xDT->start + 1]);
184 for( i = xDT->start; i < xDT->end; i++, d++, p += 2 ) {
185 *p = *d;
186 p += 2;
187 *p = *d;
188 }
189 return( values );
190}

◆ xData_init_2d_xShared_yHistogram()

int xData_init_2d_xShared_yHistogram ( statusMessageReporting smr,
xData_element element 
)

Definition at line 54 of file xData_2d_xshared_yhistogram.cc.

54 {
55
56 xDataType *xDT = &(element->xDataTypeInfo);
57
60 xDT->element = element;
61 xDT->toData = toData;
62 xDT->toString = toString;
63 xDT->release = release;
64 xDT->data = NULL;
65 return( xData_xDataTypeConvertAttributes( smr, element ) );
66}
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
int xData_xDataTypeConvertAttributes(statusMessageReporting *smr, xData_element *element)
Definition: xData.cc:668
char const *const xData_twod_xShared_yHistogram_ID
Definition: xData.h:74
@ xData_xDataType_Ok
Definition: xData.h:81

◆ xData_is_2d_xShared_yHistogram()

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

Definition at line 70 of file xData_2d_xshared_yhistogram.cc.

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

Referenced by xData_isElement_2d_xShared_yHistogram().

◆ xData_isElement_2d_xShared_yHistogram()

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

Definition at line 77 of file xData_2d_xshared_yhistogram.cc.

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