14 #ifndef _FIELD_FUNCTIONS_H
15 #define _FIELD_FUNCTIONS_H
79 bool load(
const std::vector<std::string>& fieldNames,
80 const std::string& basisName,
int level,
81 bool isScalar =
false);
92 const std::vector<Real>& coefs,
93 int nf,
int basis) = 0;
121 const std::string& basisName,
122 const std::string& fieldName,
135 const std::vector<Real>& coefs,
165 const std::string& basisName,
166 const std::string& fieldName,
202 FieldFuncStream(
const std::vector<ASMbase*>& patches, std::istream& istr);
235 const std::string& basisName,
236 const std::string& fieldName,
247 const std::vector<Real>& coefs,
285 const std::string& basisName,
286 const std::string& fieldName,
327 const std::string& basisName,
328 const std::string& fieldName,
355 const std::string& basisName,
356 const std::string& fieldName,
391 const std::string& basisName,
392 const std::string& fieldName,
419 const std::string& basisName,
420 const std::string& fieldName,
447 const std::string& basisName,
448 const std::string& fieldName,
475 const std::string& basisName,
476 const std::string& fieldName,
#define Real
The floating point type to use.
Definition: ImmersedBoundaries.h:18
Spatial tensor-valued functions.
Base class for spline-based finite element (FE) assembly drivers.
Definition: ASMbase.h:70
Base class for spatial functions, defined through patch-wise fields.
Definition: FieldFunctions.h:32
size_t npch
Number of patches in the field.
Definition: FieldFunctions.h:51
FieldFuncBase()
Default constructor.
Definition: FieldFunctions.h:38
std::vector< ASMbase * > patch
The patches on which the field is defined.
Definition: FieldFunctions.h:48
FieldFuncBase(const FieldFuncBase &)=delete
No copying of this class.
virtual ~FieldFuncBase()
The destructor deletes the patches.
Definition: FieldFunctions.C:33
static constexpr int FIXED_LEVEL
Bit flag in level for using fixed.
Definition: FieldFunctions.h:34
bool setPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.C:39
size_t pidx
Current patch index.
Definition: FieldFunctions.h:50
Base class for spatial functions, defined from a HDF5-file.
Definition: FieldFunctions.h:60
virtual void clearField()=0
Clears the field container.
FieldFuncHDF5()
Default constructor.
Definition: FieldFunctions.h:63
bool hasMultipleLevels
True if we have multiple time levels.
Definition: FieldFunctions.h:97
FieldFuncHDF5(const FieldFuncHDF5 &)=delete
No copying of this class.
HDF5Reader * hdf5
The HDF5-file containing the field data.
Definition: FieldFunctions.h:101
virtual void addPatchField(ASMbase *pch, const std::vector< Real > &coefs, int nf, int basis)=0
Adds a patch-wise field with the given coefficient values.
bool load(const std::vector< std::string > &fieldNames, const std::string &basisName, int level, bool isScalar=false)
Loads field values for the specified time level.
Definition: FieldFunctions.C:102
virtual ~FieldFuncHDF5()
The destructor closes the HDF5-file.
Definition: FieldFunctions.C:65
ProcessAdm * pAdm
Process administrator for the HDF5-file reader.
Definition: FieldFunctions.h:102
int lastLevel
The last time level read from.
Definition: FieldFunctions.h:98
double lastTime
The time of lastLevel.
Definition: FieldFunctions.h:104
int findClosestLevel(double time) const
Finds the level whose time is closest to the specified time.
Definition: FieldFunctions.C:72
Base class for field functions derived from a scalar field.
Definition: FieldFunctions.h:113
std::string fName
Name of field.
Definition: FieldFunctions.h:145
int currentLevel
Current time level to evaluate at.
Definition: FieldFunctions.h:143
FieldFuncScalarBase()
Default constructor.
Definition: FieldFunctions.h:129
virtual ~FieldFuncScalarBase()
The destructor deletes the scalar fields.
Definition: FieldFunctions.h:125
virtual void clearField()
Clears the field container.
Definition: FieldFunctions.h:138
void clearFieldInt()
Non-virtual actual implementation of clearField()
Definition: FieldFunctions.C:263
std::vector< Field * > field
The scalar field to be evaluated.
Definition: FieldFunctions.h:148
std::string bName
Name of basis.
Definition: FieldFunctions.h:146
virtual void addPatchField(ASMbase *pch, const std::vector< Real > &coefs, int, int)
Adds a patch-wise field with the given coefficient values.
Definition: FieldFunctions.C:271
A scalar-valued spatial function, defined through scalar fields.
Definition: FieldFunctions.h:197
std::vector< Field * > field
The scalar field to be evaluated.
Definition: FieldFunctions.h:214
virtual ~FieldFuncStream()
The destructor deletes the scalar fields.
Definition: FieldFunctions.C:381
FieldFuncStream(const std::vector< ASMbase * > &patches, std::istream &istr)
The constructor creates a field from the provided input stream.
Definition: FieldFunctions.C:369
virtual Real evaluate(const Vec3 &X) const
Evaluates the scalar field function.
Definition: FieldFunctions.C:387
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:207
A scalar-valued spatial function, defined through scalar fields.
Definition: FieldFunctions.h:157
virtual ~FieldFunction()
Empty destructor.
Definition: FieldFunctions.h:174
SymmTensor hessian(const Vec3 &X) const override
Evaluates second derivatives of the function.
Definition: FieldFunctions.C:342
FieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:280
bool initPatch(size_t pIdx) override
Sets the active patch.
Definition: FieldFunctions.h:177
Real evaluate(const Vec3 &X) const override
Evaluates the scalar field function.
Definition: FieldFunctions.C:298
Vec3 gradient(const Vec3 &X) const override
Evaluates first derivatives of the function.
Definition: FieldFunctions.C:320
Interface class for scalar fields.
Definition: Field.h:30
Base class for multi-valued spatial functions, defined through fields.
Definition: FieldFunctions.h:223
int currentLevel
Current time level to evaluate at.
Definition: FieldFunctions.h:262
std::vector< std::string > fName
Name of field components.
Definition: FieldFunctions.h:265
std::vector< Real > getGradient(const Vec3 &X) const
Evaluates the field gradient at the givent point X.
Definition: FieldFunctions.C:467
std::vector< Fields * > field
The vector field to be evaluated.
Definition: FieldFunctions.h:268
virtual void clearField()
Clears the field container.
Definition: FieldFunctions.C:425
virtual ~FieldsFuncBase()
The destructor deletes the vector fields.
Definition: FieldFunctions.h:239
std::string bName
Name of basis.
Definition: FieldFunctions.h:266
std::vector< Real > getHessian(const Vec3 &X) const
Evaluates the field gradient at the givent point X.
Definition: FieldFunctions.C:482
FieldsFuncBase(const std::vector< Fields * > &fields)
Construct from vector of fields.
Definition: FieldFunctions.C:402
virtual void addPatchField(ASMbase *pch, const std::vector< Real > &coefs, int nf, int basis)
Adds a patch-wise field with the given coefficient values.
Definition: FieldFunctions.C:433
std::vector< Real > getValues(const Vec3 &X)
Evaluates the field at the givent point X.
Definition: FieldFunctions.C:443
Base class for vector fields.
Definition: Fields.h:35
size_t dim() const
Returns the number of components of the return value.
Definition: Function.h:165
Read data from a HDF5 file.
Definition: FieldFunctions.C:28
Class for administration of MPI processes in IFEM library.
Definition: ProcessAdm.h:33
Scalar-valued unary function of a spatial point.
Definition: Function.h:193
A symmtensor-valued spatial function, defined through a vector field.
Definition: FieldFunctions.h:467
virtual ~STensorFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:479
virtual SymmTensor evaluate(const Vec3 &X) const
Evaluates the tensorial field function.
Definition: FieldFunctions.C:698
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:482
STensorFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:687
Symmetric tensor-valued unary function of a spatial point.
Definition: TensorFunction.h:71
A vector-valued spatial function, defined through gradient of a scalar field.
Definition: FieldFunctions.h:347
ScalarGradFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:529
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:370
virtual ~ScalarGradFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:367
virtual Vec3 evaluate(const Vec3 &X) const
Evaluates the vectorial field function.
Definition: FieldFunctions.C:551
A vector-valued spatial function, defined through laplacian of a scalar field.
Definition: FieldFunctions.h:383
ScalarLaplacianFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:568
virtual Vec3 evaluate(const Vec3 &X) const
Evaluates the vectorial field function.
Definition: FieldFunctions.C:579
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:398
virtual ~ScalarLaplacianFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:395
Simple class for representing a symmetric second-order tensor.
Definition: Tensor.h:183
A tensor-valued spatial function, defined through a vector field.
Definition: FieldFunctions.h:319
virtual Tensor evaluate(const Vec3 &X) const
Evaluates the tensorial field function.
Definition: FieldFunctions.C:610
TensorFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:599
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:334
virtual ~TensorFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:331
Tensor-valued unary function of a spatial point.
Definition: TensorFunction.h:27
Simple class for representing a non-symmetric second-order tensor.
Definition: Tensor.h:28
Simple class for representing a point in 3D space.
Definition: Vec3.h:27
A vector-valued spatial function, defined through a vector field.
Definition: FieldFunctions.h:277
bool initPatch(size_t pIdx) override
Sets the active patch.
Definition: FieldFunctions.h:299
std::vector< Real > evalHessian(const Vec3 &X) const override
Returns the hessian of the function as a 1D array.
Definition: FieldFunctions.h:309
std::vector< Real > evalGradient(const Vec3 &X) const override
Returns the gradient of the function as a 1D array.
Definition: FieldFunctions.h:306
virtual ~VecFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:296
VecFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:500
Vec3 evaluate(const Vec3 &X) const override
Evaluates the vectorial field function.
Definition: FieldFunctions.C:519
Vector-valued unary function of a spatial point.
Definition: Function.h:242
A tensor-valued spatial function, defined through gradient of a vector field.
Definition: FieldFunctions.h:411
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:426
virtual ~VecGradFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:423
VecGradFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:620
virtual Tensor evaluate(const Vec3 &X) const
Evaluates the tensorial field function.
Definition: FieldFunctions.C:631
A tensor-valued spatial function, defined through laplacian of a vector field.
Definition: FieldFunctions.h:439
virtual ~VecLaplacianFieldFunction()
Empty destructor.
Definition: FieldFunctions.h:451
VecLaplacianFieldFunction(const std::string &fileName, const std::string &basisName, const std::string &fieldName, int level=0)
The constructor creates a field from the provided HDF5-file.
Definition: FieldFunctions.C:654
virtual bool initPatch(size_t pIdx)
Sets the active patch.
Definition: FieldFunctions.h:454
virtual Tensor evaluate(const Vec3 &X) const
Evaluates the tensorial field function.
Definition: FieldFunctions.C:665