41 #if defined __cplusplus
103 while( isspace( *e ) ) e++;
105 smr_setMessageError( smr, smrUser, __FILE__, __LINE__, 1,
"2d_xindex_y contains extra data = %s", e );
109 if( status != 0 ) release( smr, xDT );
120 char *str, *
p, fmt[32] =
" %99d %15.7e\n";
124 for( i = 0; i <
n; i++, data++ ) {
125 while( ( data->
index > indexMax ) && ( indexMax > 0 ) ) {
126 indexMax = 10 * indexMax + 9;
131 sprintf( fmt,
" %%%dld %%15.7e\n", iFmt );
132 if( ( str = (
char *)
malloc( recordSize * ( n + 1 ) ) ) == NULL )
return( NULL );
158 if( xDT->
length == 0 )
return( NULL );
161 for( i = 0; i < xDT->
length; i++ ) {
163 index += data[i].
index;
184 double *values = NULL, *
p;
187 if( xDT->
length == 0 )
return( NULL );
189 if( ( values = (
double*)
xData_malloc2( smr, 2 * xDT->
length *
sizeof(
double ), 0,
"values" ) ) == NULL )
return( NULL );
191 for( i = 0; i < xDT->
length; i++, p++ ) {
192 index += data[i].
index;
204 return( xData_2d_xindex_y_toFilled( smr, element, Xs, 1 ) );
219 return( xData_2d_xindex_y_toFilled( smr, element, Xs, 2 ) );
230 double x1,
x2, *
x,
y1,
y2, *values = NULL, *
p;
233 if( xDT->
length == 0 )
return( NULL );
235 if( ( values = (
double*)
xData_malloc2( smr, size * length *
sizeof(
double ), 0,
"values" ) ) == NULL )
return( NULL );
237 x = &(Xs[xDT->
start]);
240 for( i = 0; i < xDT->
length; i++, x++, p++ ) {
241 index += data[i].
index;
246 for( j = data[i].index; j > 1; j--, x++, p++ ) {
251 *p = ( y1 * ( x2 - *
x ) + y2 * ( *x - x1 ) ) / ( x2 - x1 );
253 if( size == 2 ) *(p++) = *x;
259 #if defined __cplusplus
int xData_is_2d_xindex_y(statusMessageReporting *smr, xDataType *xDT, int setMsg)
int xData_xDataTypeConvertAttributes(statusMessageReporting *smr, xData_element *element)
void * xData_get_smrUserInterfaceFromElement(xData_element *element)
int xData_2d_xindex_y_free_toFilledYs(statusMessageReporting *smr, void *data)
int xData_2d_xindex_y_free_rawIndices(statusMessageReporting *smr, void *data)
double * xData_2d_xindex_y_toFilledXYs(statusMessageReporting *smr, xData_element *element, double *Xs)
int smr_setMessageError(statusMessageReporting *smr, void *userInterface, const char *file, int line, int code, const char *fmt,...)
int xData_is_xDataType(statusMessageReporting *smr, xDataType *xDT, char const *const type, int setMsg)
double * xData_2d_xindex_y_toFilledYs(statusMessageReporting *smr, xData_element *element, double *Xs)
#define xData_malloc2(smr, size, zero, forItem)
xData_Int * xData_2d_xindex_y_rawIndices(statusMessageReporting *smr, xData_element *element)
const char *const xData_twod_xindex_y_ID
int xData_isElement_2d_xindex_y(statusMessageReporting *smr, xData_element *element, int setMsg)
void * xData_free(statusMessageReporting *smr, void *p)
xDT_toStringFunction toString
enum xData_xDataType status
int xData_init_2d_xindex_y(statusMessageReporting *smr, xData_element *element)
xDT_releaseFunction release
int xData_setMessageError_ReturnInt(int value, statusMessageReporting *smr, void *userData, const char *file, int line, int code, const char *fmt,...)
double * xData_2d_xindex_y_toXYs(statusMessageReporting *smr, xData_element *element, double *Xs)
int xData_stringTo_xData_Int(statusMessageReporting *smr, void *smrUserInterface, char const *c, xData_Int *value, char const *endings, char **e)
void * malloc(size_t __size)
xDT_toDataFunction toData
const XML_Char const XML_Char * data
int xData_stringTo_double(statusMessageReporting *smr, void *smrUserInterface, char const *c, double *value, char const *endings, char **e)