IFEM 90A354
DualField.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _DUAL_FIELD_H
15#define _DUAL_FIELD_H
16
17#include "Function.h"
18#include "Point.h"
19#include <set>
20
21class ASMbase;
22
23
28class DualRealFunc : public RealFunc
29{
30 short int comp;
31
32public:
41 DualRealFunc(const Vec3& o, const Vec3& n, const Vec3& XZp,
42 double d, double w = 0.0, ASMbase* p = nullptr, int c = 0);
50 DualRealFunc(const Vec3& o, const Vec3& n,
51 double d, double w = 0.0, ASMbase* p = nullptr, int c = 0);
58 DualRealFunc(const utl::Point& o, const Vec3Pair& d,
59 ASMbase* p = nullptr, double eps = 0.0, int c = 0);
61 virtual ~DualRealFunc() {}
62
64 virtual unsigned char getType() const
65 {
66 return comp > 0 && depth <= 0.0 ? 3 : 1;
67 }
68
70 const Vec3& x() const { return normal; }
72 const Vec3& y() const { return tangent; }
74 Vec3 z() const { return Vec3(normal,tangent); }
75
77 double ecc(const Vec3& X, int i) const { return X(i) - X0(i); }
83 double value(const Vec3& X, bool ignoreDomain = false) const;
85 bool isPointExtraction() const { return depth <= 0.0; }
87 virtual bool inDomain(const Vec3& X) const;
89 virtual bool initPatch(size_t idx);
90
91protected:
93 virtual double evaluate(const Vec3& X) const { return this->value(X); }
94
95private:
97
100 double depth;
101 double width;
104
106 std::set<int> Delem;
107};
108
109
114class DualVecFunc : public VecFunc
115{
116 int comp;
117
118public:
127 DualVecFunc(int c, const Vec3& o, const Vec3& n, const Vec3& XZp,
128 double d, double w = 0.0, ASMbase* p = nullptr);
136 DualVecFunc(int c, const Vec3& o, const Vec3& n,
137 double d, double w = 0.0, ASMbase* p = nullptr);
144 DualVecFunc(int c, const utl::Point& o, const Vec3Pair& d,
145 ASMbase* p = nullptr, double eps = 0.0);
147 virtual ~DualVecFunc() {}
148
150 virtual unsigned char getType() const { return W.isPointExtraction() ? 3:2; }
151
153 virtual bool inDomain(const Vec3& X) const { return W.inDomain(X); }
155 virtual bool initPatch(size_t idx) { return W.initPatch(idx); }
156
158 const RealFunc& getW() const { return W; }
159
161 virtual double getScalarValue(const Vec3& X) const { return W.value(X); }
162
163protected:
166 virtual Vec3 evaluate(const Vec3& X) const;
167
168private:
170};
171
172#endif
General functions with arbitrary argument and value type.
Representation of points in 3D space with coordinates and parameters.
std::pair< Vec3, Vec3 > Vec3Pair
A pair of two point vectors.
Definition Vec3.h:316
Base class for spline-based finite element (FE) assembly drivers.
Definition ASMbase.h:72
Class representing a dual field for goal-oriented error estimation.
Definition DualField.h:29
Vec3 z() const
Returns the local Z (2nd tangent) direction of the cross section.
Definition DualField.h:74
bool isPointExtraction() const
Returns true, if the dual field is for extracting point values.
Definition DualField.h:85
virtual bool initPatch(size_t idx)
Returns true if current patch is affected by this function.
Definition DualField.C:60
Vec3 normal
Outward-directed normal vector of the cross section.
Definition DualField.h:98
const Vec3 & y() const
Returns the local Y (tangent) direction of the cross section.
Definition DualField.h:72
Vec3 Xur
Upper-right corner of box domain for point extraction.
Definition DualField.h:103
std::set< int > Delem
List of elements in domain.
Definition DualField.h:106
ASMbase * patch
The patch that this field is defined on.
Definition DualField.h:105
double width
Width of the the dual function domain (0=infinite)
Definition DualField.h:101
double value(const Vec3 &X, bool ignoreDomain=false) const
Returns the function value at the given point.
Definition DualField.C:142
virtual bool inDomain(const Vec3 &X) const
Checks if the point X is within the function domain.
Definition DualField.C:102
virtual ~DualRealFunc()
Empty destructor.
Definition DualField.h:61
utl::Point X0
Coordinates of cross section origin or reference point.
Definition DualField.h:96
virtual unsigned char getType() const
Returns the function type flag.
Definition DualField.h:64
virtual double evaluate(const Vec3 &X) const
Evaluates the dual field function.
Definition DualField.h:93
Vec3 tangent
Vector defining the local y-direction of the cross section.
Definition DualField.h:99
double ecc(const Vec3 &X, int i) const
Returns the offset from the cross section origin \ b X0.
Definition DualField.h:77
double depth
Depth of the the dual function domain (0=point extraction)
Definition DualField.h:100
const Vec3 & x() const
Returns the local X (normal) direction of the cross section.
Definition DualField.h:70
Vec3 Xll
Lower-left corner of box domain for point extraction.
Definition DualField.h:102
short int comp
Result component to extract for (0 if used as weight)
Definition DualField.h:30
Class representing a dual vector field.
Definition DualField.h:115
virtual Vec3 evaluate(const Vec3 &X) const
Evaluates the dual field function.
Definition DualField.C:185
DualRealFunc W
The scalar dual field.
Definition DualField.h:169
int comp
Which result component to extract for.
Definition DualField.h:116
virtual double getScalarValue(const Vec3 &X) const
Returns a representative scalar equivalent of the function value.
Definition DualField.h:161
virtual bool initPatch(size_t idx)
Returns true if current patch is affected by this function.
Definition DualField.h:155
virtual ~DualVecFunc()
Empty destructor.
Definition DualField.h:147
virtual bool inDomain(const Vec3 &X) const
Checks if the point X is within the function domain.
Definition DualField.h:153
virtual unsigned char getType() const
Returns the function type flag.
Definition DualField.h:150
const RealFunc & getW() const
Returns a const reference to the scalar dual field.
Definition DualField.h:158
Scalar-valued unary function of a spatial point.
Definition Function.h:193
Simple class for representing a point in 3D space.
Definition Vec3.h:27
Vector-valued unary function of a spatial point.
Definition Function.h:242
Class for representing points in 3D space.
Definition Point.h:29