escript  Revision_4925
DataC.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined escript_DataC_20040611_H
19 #define escript_DataC_20040611_H
20 #include "system_dep.h"
21 
30 struct escriptDataC {
31  void* m_dataPtr;
32 };
33 
34 typedef struct escriptDataC escriptDataC;
35 
42 
50 #define updateFunctionSpaceType(_FS,_DATA) _FS=(isEmpty(_DATA) ? _FS : getFunctionSpaceType(_DATA))
51 
58 #define functionSpaceTypeEqual(_FS,_DATA) ( (isEmpty(_DATA) || _FS==getFunctionSpaceType(_DATA)) ) ? 1 : 0
59 
66 
74 ESCRIPT_DLL_API int isDataPointShapeEqual(escriptDataC* data, int rank, const int* dimensions);
84 ESCRIPT_DLL_API int numSamplesEqual(escriptDataC* data, int numDataPointsPerSample,
85  int numSamples);
86 
93 
100 
108 
115 
116 /*
117  \brief
118  Return the number of doubles stored for the Data object.
119  Argument data may be NULL, in which case 0 is returnd.
120  \param data Input - C wrapper for Data.
121 
122 This function has been removed because it does not make sense for LazyData
123 */
124 /*ESCRIPT_DLL_API int getLength(escriptDataC* data);*/
125 
135 
145 ESCRIPT_DLL_API double __const * getSampleDataRO(escriptDataC* data, int sampleNo);
146 /* Placement of __const might be important. See .cpp */
147 
148 
149 ESCRIPT_DLL_API double* getSampleDataRW(escriptDataC* data, int sampleNo);
150 
151 
160 ESCRIPT_DLL_API double __const* getSampleDataROFast(escriptDataC* data, int sampleNo);
161 
169 ESCRIPT_DLL_API double* getSampleDataRWFast(escriptDataC* data, int sampleNo);
170 
171 
180 ESCRIPT_DLL_API double* getDataRW(escriptDataC* data);
181 
182 
191 
192 #endif
int isEmpty(escriptDataC *data)
Returns the true if the data are empty or data is NULL.
Definition: DataC.cpp:117
int isDataPointShapeEqual(escriptDataC *data, int rank, const int *dimensions)
Return true if the input shape matches the data point shape for data.
Definition: DataC.cpp:30
void * m_dataPtr
Definition: DataC.h:31
int getNumDataPointsPerSample(escriptDataC *data)
Returns the number of data points per sample.
Definition: DataC.cpp:40
double * getDataRW(escriptDataC *data)
Return getSampleDataRWFast(escriptDataC* data, 0) if there are samples. if not, returns NULL...
Definition: DataC.cpp:171
int getFunctionSpaceType(escriptDataC *data)
Return the function space type code.
Definition: DataC.cpp:23
int getDataPointShape(escriptDataC *data, int i)
Returns the value of the i-th component of the shape of the point data.
Definition: DataC.cpp:75
int getDataPointRank(escriptDataC *data)
Returns the rank of the point data for the data.
Definition: DataC.cpp:65
Provide a wrapper around a Data object so Data may be accessed from C.
Definition: DataC.h:30
double * getSampleDataRWFast(escriptDataC *data, int sampleNo)
Return a pointer to the data for the given sample number. Fast version of getSampledataRW: does no er...
Definition: DataC.cpp:165
double * getSampleDataRO(escriptDataC *data, int sampleNo)
Return a pointer to the data for the given sample number. if data is empty NULL is returned...
Definition: DataC.cpp:131
double * getSampleDataRW(escriptDataC *data, int sampleNo)
Definition: DataC.cpp:145
void requireWrite(escriptDataC *data)
Ensure that this object is ready for writing. It will be resolved and copied if it is currently share...
Definition: DataC.cpp:183
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:64
double * getSampleDataROFast(escriptDataC *data, int sampleNo)
Return a pointer to the data for the given sample number. Fast version of getSampledataRO: does no er...
Definition: DataC.cpp:159
int getDataPointSize(escriptDataC *data)
Return the number of doubles needed for each data point.
Definition: DataC.cpp:91
int isExpanded(escriptDataC *data)
Return true if data can be treated as expanded.
Definition: DataC.cpp:103
#define __const
Definition: escriptcore/src/system_dep.h:86
int numSamplesEqual(escriptDataC *data, int numDataPointsPerSample, int numSamples)
Return true if the number of data points per sample and the number of samples equal the input values...
Definition: DataC.cpp:54