IFEM  90A354
Field.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
12 //==============================================================================
13 
14 #ifndef _FIELD_H
15 #define _FIELD_H
16 
17 #include "MatVec.h"
18 #include <string>
19 
20 class ASMbase;
21 class ItgPoint;
22 class Vec4;
23 
24 
29 class Field
30 {
31 protected:
34  explicit Field(const char* name = nullptr) { if (name) fname = name; }
35 
36 public:
38  virtual ~Field() {}
39 
46  static Field* create(const ASMbase* pch, const RealArray& v,
47  char basis = 1, char cmp = 1,
48  const char* name = nullptr);
49 
51  const char* getFieldName() const { return fname.c_str(); }
52 
53  // Methods to evaluate the field
54  //==============================
55 
58  virtual double valueNode(size_t node) const = 0;
59 
62  virtual double valueFE(const ItgPoint& x) const = 0;
63 
66  virtual double valueCoor(const Vec4& x) const { return 0.0; }
67 
71  virtual bool valueGrid(RealArray& val, const int* npe) const { return false; }
72 
76  virtual bool gradFE(const ItgPoint& x, Vector& grad) const = 0;
77 
81  virtual bool gradCoor(const Vec4& x, Vector& grad) const { return false; }
82 
86  virtual bool hessianFE(const ItgPoint& x, Matrix& H) const { return false; }
87 
88 protected:
89  std::string fname;
90 };
91 
92 #endif
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition: ImmersedBoundaries.h:29
Global algebraic operations on index 1-based matrices and vectors.
Base class for spline-based finite element (FE) assembly drivers.
Definition: ASMbase.h:70
Interface class for scalar fields.
Definition: Field.h:30
static Field * create(const ASMbase *pch, const RealArray &v, char basis=1, char cmp=1, const char *name=nullptr)
Creates a dynamically allocated field object.
Definition: Field.C:28
virtual bool gradCoor(const Vec4 &x, Vector &grad) const
Computes the gradient for a given global/physical coordinate.
Definition: Field.h:81
virtual double valueCoor(const Vec4 &x) const
Computes the value at a given global coordinate.
Definition: Field.h:66
Field(const char *name=nullptr)
The constructor sets the field name.
Definition: Field.h:34
virtual ~Field()
Empty destructor.
Definition: Field.h:38
virtual bool valueGrid(RealArray &val, const int *npe) const
Computes the value at a grid of visualization points.
Definition: Field.h:71
virtual bool gradFE(const ItgPoint &x, Vector &grad) const =0
Computes the gradient for a given local coordinate.
virtual double valueNode(size_t node) const =0
Computes the value in a given node/control point.
virtual bool hessianFE(const ItgPoint &x, Matrix &H) const
Computes the hessian for a given local coordinate.
Definition: Field.h:86
std::string fname
Name of the field.
Definition: Field.h:89
const char * getFieldName() const
Returns the name of field.
Definition: Field.h:51
virtual double valueFE(const ItgPoint &x) const =0
Computes the value at a given local coordinate.
Class representing an integration point.
Definition: ItgPoint.h:25
Simple class for representing a point in 3D space and time.
Definition: Vec3.h:209
A vector class with some added algebraic operations.
Definition: matrix.h:64