IFEM 90A354
Fields.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _FIELDS_H
15#define _FIELDS_H
16
17#include "MatVec.h"
18#include <string>
19
20class ASMbase;
21class ItgPoint;
22class Vec4;
23
24
34class Fields
35{
36protected:
39 explicit Fields(const char* name = nullptr) : nf(0), nelm(0), nno(0)
40 { if (name) fname = name; }
41
42public:
44 virtual ~Fields() {}
45
47 unsigned char getNoFields() const { return nf; }
48
50 size_t getNoElm() const { return nelm; }
51
53 size_t getNoNodes() const { return nno; }
54
56 const char* getFieldName() const { return fname.c_str(); }
57
64 static Fields* create(const ASMbase* pch, const RealArray& v,
65 char basis = 1, int nf = 0, const char* name = nullptr);
66
67 // Methods to evaluate the field
68 //==============================
69
73 virtual bool valueNode(size_t node, Vector& vals) const;
74
78 virtual bool valueFE(const ItgPoint& x, Vector& vals) const = 0;
79
83 virtual bool valueCoor(const Vec4& x, Vector& vals) const { return false; }
84
88 virtual bool gradFE(const ItgPoint& x, Matrix& grad) const = 0;
89
93 virtual bool gradCoor(const Vec4& x, Matrix& grad) const { return false; }
94
98 virtual bool hessianFE(const ItgPoint& x, Matrix3D& H) const { return false; }
99
100protected:
101 unsigned char nf;
102 size_t nelm;
103 size_t nno;
104 std::string fname;
106};
107
108#endif
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition ImmersedBoundaries.h:32
Global algebraic operations on index 1-based matrices and vectors.
Base class for spline-based finite element (FE) assembly drivers.
Definition ASMbase.h:72
Base class for vector fields.
Definition Fields.h:35
size_t getNoElm() const
Returns the number of elements.
Definition Fields.h:50
Fields(const char *name=nullptr)
The constructor sets the field name.
Definition Fields.h:39
virtual bool gradCoor(const Vec4 &x, Matrix &grad) const
Computes the gradient for a given global coordinate.
Definition Fields.h:93
Vector values
Field values.
Definition Fields.h:105
std::string fname
Name of the field.
Definition Fields.h:104
size_t getNoNodes() const
Returns the number of nodal/control points.
Definition Fields.h:53
virtual bool valueFE(const ItgPoint &x, Vector &vals) const =0
Computes the value for a given local coordinate.
virtual bool valueCoor(const Vec4 &x, Vector &vals) const
Computes the value for a given global coordinate.
Definition Fields.h:83
virtual bool gradFE(const ItgPoint &x, Matrix &grad) const =0
Computes the gradient for a given local coordinate.
const char * getFieldName() const
Returns the name of field.
Definition Fields.h:56
static Fields * create(const ASMbase *pch, const RealArray &v, char basis=1, int nf=0, const char *name=nullptr)
Creates a dynamically allocated field object.
Definition Fields.C:36
virtual bool valueNode(size_t node, Vector &vals) const
Computes the value at a given node/control point.
Definition Fields.C:74
virtual bool hessianFE(const ItgPoint &x, Matrix3D &H) const
Computes the hessian for a given local coordinate.
Definition Fields.h:98
size_t nelm
Number of elements/knot-spans.
Definition Fields.h:102
unsigned char getNoFields() const
Returns the number of field components.
Definition Fields.h:47
size_t nno
Number of nodes/control points.
Definition Fields.h:103
unsigned char nf
Number of field components.
Definition Fields.h:101
virtual ~Fields()
Empty destructor.
Definition Fields.h:44
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