DataReady.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#if !defined escript_DataReady_20081008_H
#define escript_DataReady_20081008_H
#include "system_dep.h"
#include "DataAbstract.h"
namespace escript {
// Anything which requires getVector should be moved down here
class DataReady : public DataAbstract
{
typedef DataAbstract parent;
public:
DataReady(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty=false);
~DataReady(){};
ESCRIPT_DLL_API
DataTypes::real_t*
getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0);
ESCRIPT_DLL_API
DataTypes::cplx_t*
getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy);
ESCRIPT_DLL_API
const DataTypes::real_t*
getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const;
ESCRIPT_DLL_API
const DataTypes::cplx_t*
getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy) const;
ESCRIPT_DLL_API
virtual DataTypes::RealVectorType&
getVectorRW()=0;
ESCRIPT_DLL_API
virtual const DataTypes::RealVectorType&
getVectorRO() const=0;
ESCRIPT_DLL_API
virtual DataTypes::CplxVectorType&
getVectorRWC()=0;
ESCRIPT_DLL_API
virtual const DataTypes::CplxVectorType&
getVectorROC() const=0;
ESCRIPT_DLL_API
virtual DataTypes::RealVectorType&
getTypedVectorRW(DataTypes::real_t dummy)=0;
ESCRIPT_DLL_API
virtual const DataTypes::RealVectorType&
getTypedVectorRO(DataTypes::real_t dummy) const=0;
ESCRIPT_DLL_API
virtual DataTypes::CplxVectorType&
getTypedVectorRW(DataTypes::cplx_t dummy)=0;
ESCRIPT_DLL_API
virtual const DataTypes::CplxVectorType&
getTypedVectorRO(DataTypes::cplx_t dummy) const=0;
ESCRIPT_DLL_API
virtual bool
hasNaN() const=0;
ESCRIPT_DLL_API
virtual void
replaceNaN(DataTypes::real_t value) = 0;
ESCRIPT_DLL_API
virtual void
replaceNaN(DataTypes::cplx_t value) = 0;
ESCRIPT_DLL_API
virtual
void
setSlice(const DataAbstract* value,
const DataTypes::RegionType& region) = 0;
ESCRIPT_DLL_API
DataTypes::RealVectorType::const_reference
getDataAtOffsetRO(DataTypes::RealVectorType::size_type i) const;
ESCRIPT_DLL_API
DataTypes::RealVectorType::reference
getDataAtOffsetRW(DataTypes::RealVectorType::size_type i);
ESCRIPT_DLL_API
DataTypes::CplxVectorType::const_reference
getDataAtOffsetROC(DataTypes::CplxVectorType::size_type i) const;
ESCRIPT_DLL_API
DataTypes::CplxVectorType::reference
getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i);
ESCRIPT_DLL_API
DataReady_ptr
resolve();
};
inline
DataTypes::real_t*
DataReady::getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy)
{
return &(getVectorRW()[getPointOffset(sampleNo,0)]); // exclusive write checks will be done in getVectorRW()
}
inline
DataTypes::cplx_t*
DataReady::getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy)
{
return &(getVectorRWC()[getPointOffset(sampleNo,0)]); // exclusive write checks will be done in getVectorRW()
}
inline const DataTypes::real_t*
DataReady::getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy) const
{
return &(getVectorRO()[getPointOffset(sampleNo,0)]);
}
inline const DataTypes::cplx_t*
DataReady::getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy) const
{
return &(getVectorROC()[getPointOffset(sampleNo,0)]);
}
inline
DataTypes::RealVectorType::const_reference
DataReady::getDataAtOffsetRO(DataTypes::RealVectorType::size_type i) const
{
return getVectorRO()[i];
}
inline
DataTypes::RealVectorType::reference
DataReady::getDataAtOffsetRW(DataTypes::RealVectorType::size_type i) // exclusive write checks will be done in getVectorRW()
{
return getVectorRW()[i];
}
inline
DataTypes::CplxVectorType::const_reference
DataReady::getDataAtOffsetROC(DataTypes::CplxVectorType::size_type i) const
{
return getVectorROC()[i];
}
inline
DataTypes::CplxVectorType::reference
DataReady::getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i) // exclusive write checks will be done in getVectorRW()
{
return getVectorRWC()[i];
}
}
#endif
escript::FunctionSpace
Definition: FunctionSpace.h:34
escript::DataReady::getVectorROC
virtual const DataTypes::CplxVectorType & getVectorROC() const =0
escript::DataAbstract::ShapeType
DataTypes::ShapeType ShapeType
Definition: DataAbstract.h:66
escript::DataTypes::DataVectorAlt< real_t >::reference
ElementType & reference
Definition: DataVectorAlt.h:50
escript::DataReady
Definition: DataReady.h:35
escript::DataTypes::DataVectorAlt< real_t >::size_type
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:49
escript::DataTypes::RegionType
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:43
escript
Definition: AbstractContinuousDomain.cpp:22
escript::DataReady::getDataAtOffsetRW
DataTypes::RealVectorType::reference getDataAtOffsetRW(DataTypes::RealVectorType::size_type i)
Definition: DataReady.h:217
escript::DataReady::getDataAtOffsetROC
DataTypes::CplxVectorType::const_reference getDataAtOffsetROC(DataTypes::CplxVectorType::size_type i) const
Definition: DataReady.h:225
escript::DataReady::getDataAtOffsetRWC
DataTypes::CplxVectorType::reference getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i)
Definition: DataReady.h:232
escript::DataReady::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample number.
Definition: DataReady.h:181
escript::DataAbstract::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const =0
Return the offset for the given sample. This returns the offset for the given point into the containe...
system_dep.h
escript::DataReady::getVectorRWC
virtual DataTypes::CplxVectorType & getVectorRWC()=0
escript::DataReady::setSlice
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)=0
Copy the specified region from the given object.
escript::DataReady::hasNaN
virtual bool hasNaN() const =0
return true if data contains NaN.
escript::DataTypes::DataVectorAlt< real_t >
escript::DataReady::DataReady
DataReady(const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false)
Definition: DataReady.cpp:22
escript::DataReady::~DataReady
~DataReady()
Definition: DataReady.h:40
escript::DataReady::getDataAtOffsetRO
DataTypes::RealVectorType::const_reference getDataAtOffsetRO(DataTypes::RealVectorType::size_type i) const
get a reference to the beginning of a data point
Definition: DataReady.h:210
escript::DataReady::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Definition: DataReady.h:195
escript::DataReady::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const =0
escript::DataReady::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)=0
These versions use the type system rather than method name to determine return type.
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:53
DataAbstract.h
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
escript::DataReady::replaceNaN
virtual void replaceNaN(DataTypes::real_t value)=0
replaces all NaN values with value
escript::DataReady::resolve
DataReady_ptr resolve()
Return a data object with all points resolved.
Definition: DataReady.cpp:29
escript::DataAbstract
Definition: DataAbstract.h:61
escript::DataTypes::DataVectorAlt< real_t >::const_reference
const ElementType & const_reference
Definition: DataVectorAlt.h:51
escript::DataReady::getVectorRW
virtual DataTypes::RealVectorType & getVectorRW()=0
Provide access to underlying storage. Internal use only!
escript::DataReady_ptr
boost::shared_ptr< DataReady > DataReady_ptr
Definition: DataAbstract.h:56
escript::DataReady::getVectorRO
virtual const DataTypes::RealVectorType & getVectorRO() const =0
escript::DataReady::parent
DataAbstract parent
Definition: DataReady.h:37
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50