escript  Revision_
DataC.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
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 
22 #include "Data.h"
23 
24 
25 
32 
40 #define updateFunctionSpaceType(_FS,_DATA) _FS=(isEmpty(_DATA) ? _FS : getFunctionSpaceType(_DATA))
41 
48 #define functionSpaceTypeEqual(_FS,_DATA) ( (isEmpty(_DATA) || _FS==getFunctionSpaceType(_DATA)) ) ? 1 : 0
49 
55 ESCRIPT_DLL_API int isEmpty(const escript::Data* data);
56 
64 ESCRIPT_DLL_API int isDataPointShapeEqual(const escript::Data* data, int rank, const int* dimensions);
74 ESCRIPT_DLL_API int numSamplesEqual(const escript::Data* data, int numDataPointsPerSample,
75  dim_t numSamples);
76 
83 
90 
97 ESCRIPT_DLL_API int getDataPointShape(const escript::Data* data, int i);
98 
105 
114 ESCRIPT_DLL_API int isExpanded(const escript::Data* data);
115 
125 ESCRIPT_DLL_API double const * getSampleDataRO(const escript::Data* data, int sampleNo);
126 /* Placement of __const might be important. See .cpp */
127 
128 
129 ESCRIPT_DLL_API double* getSampleDataRW(escript::Data* data, int sampleNo);
130 
131 
140 ESCRIPT_DLL_API double const* getSampleDataROFast(const escript::Data* data, int sampleNo);
141 
149 ESCRIPT_DLL_API double* getSampleDataRWFast(escript::Data* data, int sampleNo);
150 
151 
161 
162 
171 
172 #endif
int getDataPointShape(const escript::Data *data, int i)
Returns the value of the i-th component of the shape of the point data.
Definition: DataC.cpp:72
double const * getSampleDataROFast(const escript::Data *data, int sampleNo)
Return a pointer to the data for the given sample number. Fast version of getSampledataRO: does no er...
Definition: DataC.cpp:145
double const * getSampleDataRO(const escript::Data *data, int sampleNo)
Return a pointer to the data for the given sample number. if data is empty NULL is returned...
Definition: DataC.cpp:119
int getFunctionSpaceType(const escript::Data *data)
Return the function space type code.
Definition: DataC.cpp:25
double * getSampleDataRWFast(escript::Data *data, int sampleNo)
Return a pointer to the data for the given sample number. Fast version of getSampledataRW: does no er...
Definition: DataC.cpp:150
void requireWrite(escript::Data *data)
Ensure that this object is ready for writing. It will be resolved and copied if it is currently share...
Definition: DataC.cpp:167
double * getDataRW(escript::Data *data)
Return getSampleDataRWFast(escriptDataC* data, 0) if there are samples. if not, returns NULL...
Definition: DataC.cpp:155
int numSamplesEqual(const escript::Data *data, int numDataPointsPerSample, dim_t numSamples)
Return true if the number of data points per sample and the number of samples equal the input values...
Definition: DataC.cpp:53
int getDataPointSize(const escript::Data *data)
Return the number of doubles needed for each data point.
Definition: DataC.cpp:87
double * getSampleDataRW(escript::Data *data, int sampleNo)
Definition: DataC.cpp:132
int getNumDataPointsPerSample(const escript::Data *data)
Returns the number of data points per sample.
Definition: DataC.cpp:40
int isExpanded(const escript::Data *data)
Return true if data can be treated as expanded.
Definition: DataC.cpp:97
Data represents a collection of datapoints.
Definition: Data.h:68
int getDataPointRank(const escript::Data *data)
Returns the rank of the point data for the data.
Definition: DataC.cpp:63
int isEmpty(const escript::Data *data)
Returns the true if the data are empty or data is NULL.
Definition: DataC.cpp:110
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:54
index_t dim_t
Definition: types.h:27
int isDataPointShapeEqual(const escript::Data *data, int rank, const int *dimensions)
Return true if the input shape matches the data point shape for data.
Definition: DataC.cpp:31