Skip to content
Snippets Groups Projects
Commit 48b43a53 authored by Éric Béchet's avatar Éric Béchet
Browse files

No commit message

No commit message
parent 36eae5e3
No related branches found
No related tags found
No related merge requests found
...@@ -161,6 +161,10 @@ class MElement ...@@ -161,6 +161,10 @@ class MElement
virtual int getNumChildren() const { return 0; } virtual int getNumChildren() const { return 0; }
virtual MElement *getChild(int i) const { return NULL; } virtual MElement *getChild(int i) const { return NULL; }
virtual bool ownsParent() const { return false; } virtual bool ownsParent() const { return false; }
// get base element in case of MSubElement
virtual const MElement *getBaseElement() const { return this; }
virtual MElement *getBaseElement() { return this; }
// get and set domain for borders // get and set domain for borders
virtual MElement *getDomain(int i) const { return NULL; } virtual MElement *getDomain(int i) const { return NULL; }
virtual void setDomain (MElement *e, int i) { } virtual void setDomain (MElement *e, int i) { }
...@@ -239,10 +243,10 @@ class MElement ...@@ -239,10 +243,10 @@ class MElement
int order=-1); int order=-1);
// return the Jacobian of the element evaluated at point (u,v,w) in // return the Jacobian of the element evaluated at point (u,v,w) in
// parametric coordinates // parametric coordinates
double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]); virtual double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]);
// To be compatible with _vgrads of functionSpace without having to put under fullMatrix form // To be compatible with _vgrads of functionSpace without having to put under fullMatrix form
double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]); virtual double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]);
double getJacobian(double u, double v, double w, double jac[3][3]); virtual double getJacobian(double u, double v, double w, double jac[3][3]);
inline double getJacobian(double u, double v, double w, fullMatrix<double> &j){ inline double getJacobian(double u, double v, double w, fullMatrix<double> &j){
double JAC[3][3]; double JAC[3][3];
const double detJ = getJacobian (u,v,w,JAC); const double detJ = getJacobian (u,v,w,JAC);
...@@ -253,7 +257,7 @@ class MElement ...@@ -253,7 +257,7 @@ class MElement
} }
return detJ; return detJ;
} }
double getPrimaryJacobian(double u, double v, double w, double jac[3][3]); virtual double getPrimaryJacobian(double u, double v, double w, double jac[3][3]);
double getJacobianDeterminant(double u, double v, double w) double getJacobianDeterminant(double u, double v, double w)
{ {
double jac[3][3]; return getJacobian(u, v, w, jac); double jac[3][3]; return getJacobian(u, v, w, jac);
......
This diff is collapsed.
...@@ -23,22 +23,43 @@ class MSubTetrahedron : public MTetrahedron ...@@ -23,22 +23,43 @@ class MSubTetrahedron : public MTetrahedron
bool _owner; bool _owner;
MElement* _orig; MElement* _orig;
std::vector<MElement*> _parents; std::vector<MElement*> _parents;
IntPt *_intpt; mutable MElement* _base;
int _pOrder;
int _npts;
IntPt *_pts;
public: public:
MSubTetrahedron(MVertex *v0, MVertex *v1, MVertex *v2, MVertex *v3, int num=0, MSubTetrahedron(MVertex *v0, MVertex *v1, MVertex *v2, MVertex *v3, int num=0, int part=0,
int part=0, bool owner=false, MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MTetrahedron(v0, v1, v2, v3, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MTetrahedron(v0, v1, v2, v3, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubTetrahedron(std::vector<MVertex*> v, int num=0, int part=0, bool owner=false, MSubTetrahedron(std::vector<MVertex*> v, int num=0, int part=0,
MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MTetrahedron(v, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MTetrahedron(v, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubTetrahedron(const MTetrahedron &tet, bool owner=false, MElement* orig=NULL) MSubTetrahedron(const MTetrahedron &tet, bool owner=false, MElement* orig=NULL)
: MTetrahedron(tet), _owner(owner), _orig(orig), _intpt(0) {} : MTetrahedron(tet), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
~MSubTetrahedron(); ~MSubTetrahedron();
virtual int getTypeForMSH() const { return MSH_TET_SUB; } virtual int getTypeForMSH() const { return MSH_TET_SUB; }
virtual const nodalBasis* getFunctionSpace(int order=-1) const;
virtual const JacobianBasis* getJacobianFuncSpace(int order=-1) const;
// the parametric coordinates are the coordinates in the local parent element // the parametric coordinates are the coordinates in the local parent element
virtual void getShapeFunctions(double u, double v, double w, double s[], int order=-1);
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int order=-1);
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int order=-1);
virtual void getThirdDerivativeShapeFunctions(double u, double v, double w, double s[][3][3][3], int order=-1);
virtual double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]);
virtual double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]);
virtual double getJacobian(double u, double v, double w, double jac[3][3]);
virtual double getPrimaryJacobian(double u, double v, double w, double jac[3][3]);
virtual int getNumShapeFunctions();
virtual int getNumPrimaryShapeFunctions();
virtual MVertex* getShapeFunctionNode(int i);
virtual void movePointFromParentSpaceToElementSpace(double &u, double &v, double &w);
virtual void movePointFromElementSpaceToParentSpace(double &u, double &v, double &w);
virtual bool isInside(double u, double v, double w); virtual bool isInside(double u, double v, double w);
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts); virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
virtual MElement *getParent() const { return _orig; } virtual MElement *getParent() const { return _orig; }
virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; } virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; }
virtual bool ownsParent() const { return _owner; } virtual bool ownsParent() const { return _owner; }
...@@ -47,6 +68,9 @@ class MSubTetrahedron : public MTetrahedron ...@@ -47,6 +68,9 @@ class MSubTetrahedron : public MTetrahedron
{ {
_parents = parents; _orig = _parents[0]; _owner = owner; _parents = parents; _orig = _parents[0]; _owner = owner;
} }
virtual const MElement *getBaseElement() const {if(!_base) _base=new MTetrahedron(*this); return _base;}
virtual MElement *getBaseElement() {if(!_base) _base=new MTetrahedron(*this); return _base;}
}; };
// A sub triangle, contained in another element // A sub triangle, contained in another element
...@@ -56,21 +80,43 @@ class MSubTriangle : public MTriangle ...@@ -56,21 +80,43 @@ class MSubTriangle : public MTriangle
bool _owner; bool _owner;
MElement* _orig; MElement* _orig;
std::vector<MElement*> _parents; std::vector<MElement*> _parents;
IntPt *_intpt; mutable MElement* _base;
int _pOrder;
int _npts;
IntPt *_pts;
public: public:
MSubTriangle(MVertex *v0, MVertex *v1, MVertex *v2, int num=0, int part=0, MSubTriangle(MVertex *v0, MVertex *v1, MVertex *v2, int num=0, int part=0,
bool owner=false, MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MTriangle(v0, v1, v2, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MTriangle(v0, v1, v2, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubTriangle(std::vector<MVertex*> v, int num=0, int part=0, bool owner=false, MSubTriangle(std::vector<MVertex*> v, int num=0, int part=0,
MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MTriangle(v, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MTriangle(v, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubTriangle(const MTriangle &tri, bool owner=false, MElement* orig=NULL) MSubTriangle(const MTriangle &tri, bool owner=false, MElement* orig=NULL)
: MTriangle(tri), _owner(owner), _orig(orig), _intpt(0) {} : MTriangle(tri), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
~MSubTriangle(); ~MSubTriangle();
virtual int getTypeForMSH() const { return MSH_TRI_SUB; } virtual int getTypeForMSH() const { return MSH_TRI_SUB; }
virtual const nodalBasis* getFunctionSpace(int order=-1) const;
virtual const JacobianBasis* getJacobianFuncSpace(int order=-1) const;
// the parametric coordinates are the coordinates in the local parent element // the parametric coordinates are the coordinates in the local parent element
virtual void getShapeFunctions(double u, double v, double w, double s[], int order=-1);
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int order=-1);
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int order=-1);
virtual void getThirdDerivativeShapeFunctions(double u, double v, double w, double s[][3][3][3], int order=-1);
virtual double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]);
virtual double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]);
virtual double getJacobian(double u, double v, double w, double jac[3][3]);
virtual double getPrimaryJacobian(double u, double v, double w, double jac[3][3]);
virtual int getNumShapeFunctions();
virtual int getNumPrimaryShapeFunctions();
virtual MVertex* getShapeFunctionNode(int i);
virtual void movePointFromParentSpaceToElementSpace(double &u, double &v, double &w);
virtual void movePointFromElementSpaceToParentSpace(double &u, double &v, double &w);
virtual bool isInside(double u, double v, double w); virtual bool isInside(double u, double v, double w);
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts); virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
virtual MElement *getParent() const { return _orig; } virtual MElement *getParent() const { return _orig; }
virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; } virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; }
virtual bool ownsParent() const { return _owner; } virtual bool ownsParent() const { return _owner; }
...@@ -79,6 +125,9 @@ class MSubTriangle : public MTriangle ...@@ -79,6 +125,9 @@ class MSubTriangle : public MTriangle
{ {
_parents = parents; _orig = _parents[0]; _owner = owner; _parents = parents; _orig = _parents[0]; _owner = owner;
} }
virtual const MElement *getBaseElement() const {if(!_base) _base=new MTriangle(*this); return _base;}
virtual MElement *getBaseElement() {if(!_base) _base=new MTriangle(*this); return _base;}
}; };
// A sub line, contained in another element // A sub line, contained in another element
...@@ -88,22 +137,43 @@ class MSubLine : public MLine ...@@ -88,22 +137,43 @@ class MSubLine : public MLine
bool _owner; bool _owner;
MElement* _orig; MElement* _orig;
std::vector<MElement*> _parents; std::vector<MElement*> _parents;
IntPt *_intpt; mutable MElement* _base;
int _pOrder;
int _npts;
IntPt *_pts;
public: public:
MSubLine(MVertex *v0, MVertex *v1, int num=0, int part=0, bool owner=false, MSubLine(MVertex *v0, MVertex *v1, int num=0, int part=0,
MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MLine(v0, v1, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MLine(v0, v1, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubLine(std::vector<MVertex*> v, int num=0, int part=0, bool owner=false, MSubLine(std::vector<MVertex*> v, int num=0, int part=0,
MElement* orig=NULL) bool owner=false, MElement* orig=NULL)
: MLine(v, num, part), _owner(owner), _orig(orig), _intpt(0) {} : MLine(v, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubLine(const MLine &lin, bool owner=false, MElement* orig=NULL) MSubLine(const MLine &lin, bool owner=false, MElement* orig=NULL)
: MLine(lin), _owner(owner), _orig(orig), _intpt(0) {} : MLine(lin), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
~MSubLine(); ~MSubLine();
virtual int getTypeForMSH() const { return MSH_LIN_SUB; } virtual int getTypeForMSH() const { return MSH_LIN_SUB; }
virtual const nodalBasis* getFunctionSpace(int order=-1) const;
virtual const JacobianBasis* getJacobianFuncSpace(int order=-1) const;
// the parametric coordinates are the coordinates in the local parent element // the parametric coordinates are the coordinates in the local parent element
virtual void getShapeFunctions(double u, double v, double w, double s[], int order=-1);
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int order=-1);
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int order=-1);
virtual void getThirdDerivativeShapeFunctions(double u, double v, double w, double s[][3][3][3], int order=-1);
virtual double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]);
virtual double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]);
virtual double getJacobian(double u, double v, double w, double jac[3][3]);
virtual double getPrimaryJacobian(double u, double v, double w, double jac[3][3]);
virtual int getNumShapeFunctions();
virtual int getNumPrimaryShapeFunctions();
virtual MVertex* getShapeFunctionNode(int i);
virtual void movePointFromParentSpaceToElementSpace(double &u, double &v, double &w);
virtual void movePointFromElementSpaceToParentSpace(double &u, double &v, double &w);
virtual bool isInside(double u, double v, double w); virtual bool isInside(double u, double v, double w);
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts); virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
virtual MElement *getParent() const { return _orig; } virtual MElement *getParent() const { return _orig; }
virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; } virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; }
virtual bool ownsParent() const { return _owner; } virtual bool ownsParent() const { return _owner; }
...@@ -112,6 +182,9 @@ class MSubLine : public MLine ...@@ -112,6 +182,9 @@ class MSubLine : public MLine
{ {
_parents = parents; _orig = _parents[0]; _owner = owner; _parents = parents; _orig = _parents[0]; _owner = owner;
} }
virtual const MElement *getBaseElement() const {if(!_base) _base=new MLine(*this); return _base;}
virtual MElement *getBaseElement() {if(!_base) _base=new MLine(*this); return _base;}
}; };
// A sub point, contained in another element // A sub point, contained in another element
...@@ -121,21 +194,43 @@ class MSubPoint : public MPoint ...@@ -121,21 +194,43 @@ class MSubPoint : public MPoint
bool _owner; bool _owner;
MElement* _orig; MElement* _orig;
std::vector<MElement*> _parents; std::vector<MElement*> _parents;
IntPt *_intpt; mutable MElement* _base;
int _pOrder;
int _npts;
IntPt *_pts;
public: public:
MSubPoint(MVertex *v0, int num=0, int part=0, bool owner=false, MElement* orig=NULL) MSubPoint(MVertex *v0, int num=0, int part=0,
: MPoint(v0, num, part), _owner(owner), _orig(orig), _intpt(0) {} bool owner=false, MElement* orig=NULL)
MSubPoint(std::vector<MVertex*> v, int num=0, int part=0, bool owner=false, : MPoint(v0, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MElement* orig=NULL) MSubPoint(std::vector<MVertex*> v, int num=0, int part=0,
: MPoint(v, num, part), _owner(owner), _orig(orig), _intpt(0) {} bool owner=false, MElement* orig=NULL)
: MPoint(v, num, part), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
MSubPoint(const MPoint &pt, bool owner=false, MElement* orig=NULL) MSubPoint(const MPoint &pt, bool owner=false, MElement* orig=NULL)
: MPoint(pt), _owner(owner), _orig(orig), _intpt(0) {} : MPoint(pt), _owner(owner), _orig(orig), _base(0), _pOrder(-1), _npts(0), _pts(0) {}
~MSubPoint(); ~MSubPoint();
virtual int getTypeForMSH() const { return MSH_PNT_SUB; } virtual int getTypeForMSH() const { return MSH_PNT_SUB; }
virtual const nodalBasis* getFunctionSpace(int order=-1) const;
virtual const JacobianBasis* getJacobianFuncSpace(int order=-1) const;
// the parametric coordinates are the coordinates in the local parent element // the parametric coordinates are the coordinates in the local parent element
virtual void getShapeFunctions(double u, double v, double w, double s[], int order=-1);
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int order=-1);
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int order=-1);
virtual void getThirdDerivativeShapeFunctions(double u, double v, double w, double s[][3][3][3], int order=-1);
virtual double getJacobian(const fullMatrix<double> &gsf, double jac[3][3]);
virtual double getJacobian(const std::vector<SVector3> &gsf, double jac[3][3]);
virtual double getJacobian(double u, double v, double w, double jac[3][3]);
virtual double getPrimaryJacobian(double u, double v, double w, double jac[3][3]);
virtual int getNumShapeFunctions();
virtual int getNumPrimaryShapeFunctions();
virtual MVertex* getShapeFunctionNode(int i);
virtual void movePointFromParentSpaceToElementSpace(double &u, double &v, double &w);
virtual void movePointFromElementSpaceToParentSpace(double &u, double &v, double &w);
virtual bool isInside(double u, double v, double w); virtual bool isInside(double u, double v, double w);
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts); virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
virtual MElement *getParent() const { return _orig; } virtual MElement *getParent() const { return _orig; }
virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; } virtual void setParent(MElement *p, bool owner = false) { _orig = p; _owner = owner; }
virtual bool ownsParent() const { return _owner; } virtual bool ownsParent() const { return _owner; }
...@@ -144,6 +239,9 @@ class MSubPoint : public MPoint ...@@ -144,6 +239,9 @@ class MSubPoint : public MPoint
{ {
_parents = parents; _orig = _parents[0]; _owner = owner; _parents = parents; _orig = _parents[0]; _owner = owner;
} }
virtual const MElement *getBaseElement() const {if(!_base) _base=new MPoint(*this); return _base;}
virtual MElement *getBaseElement() {if(!_base) _base=new MPoint(*this); return _base;}
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment