From 8427807faf8361da9ec18170c9b4f074a5a94c39 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 8 Nov 2008 20:44:15 +0000 Subject: [PATCH] *** empty log message *** --- Numeric/gmshAssembler.h | 8 ++++---- Numeric/gmshElasticity.h | 21 +++++++++++---------- Numeric/gmshLaplace.h | 16 +++++++++------- Numeric/gmshTermOfFormulation.h | 22 +++++++++++++--------- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/Numeric/gmshAssembler.h b/Numeric/gmshAssembler.h index 12a9a1b14e..529506e92e 100644 --- a/Numeric/gmshAssembler.h +++ b/Numeric/gmshAssembler.h @@ -87,14 +87,14 @@ public: return lsys->getFromSolution (it->second); } { - std::map<gmshDofKey, std::vector<std::pair<gmshDofKey,double> > >::const_iterator itConstr = - constraints.find(key); + std::map<gmshDofKey, std::vector<std::pair<gmshDofKey,double> > >:: + const_iterator itConstr = constraints.find(key); if (itConstr != constraints.end()){ double val = 0; - for (int i=0;i<itConstr->second.size();i++){ + for (int i = 0; i < itConstr->second.size(); i++){ const gmshDofKey &dofKeyConstr = itConstr->second[i].first; double valConstr = itConstr->second[i].second; - val += getDofValue (dofKeyConstr.v,dofKeyConstr.comp , dofKeyConstr.field) + val += getDofValue(dofKeyConstr.v, dofKeyConstr.comp, dofKeyConstr.field) * valConstr; } return val; diff --git a/Numeric/gmshElasticity.h b/Numeric/gmshElasticity.h index b068889eb7..fd91644c2a 100644 --- a/Numeric/gmshElasticity.h +++ b/Numeric/gmshElasticity.h @@ -1,5 +1,6 @@ #ifndef _GMSH_ELASTICITY_H_ #define _GMSH_ELASTICITY_H_ + #include "gmshTermOfFormulation.h" #include "Gmsh.h" #include "GModel.h" @@ -10,19 +11,19 @@ class gmshElasticityTerm : public gmshNodalFemTerm { double _E,_nu; int _iField; protected: - virtual int sizeOfR (MElement *e) const {return 3*e->getNumVertices();} - virtual int sizeOfC (MElement *e) const {return 3*e->getNumVertices();} - void getLocalDofR (MElement *e, int iRow, MVertex **vR, int *iCompR, int *iFieldR) const + virtual int sizeOfR(MElement *e) const { return 3 * e->getNumVertices(); } + virtual int sizeOfC(MElement *e) const { return 3 * e->getNumVertices(); } + void getLocalDofR(MElement *e, int iRow, MVertex **vR, int *iCompR, int *iFieldR) const { - *iCompR = iRow/e->getNumVertices(); - int ithLocalVertex = iRow%e->getNumVertices(); - *vR = e->getVertex (ithLocalVertex); + *iCompR = iRow / e->getNumVertices(); + int ithLocalVertex = iRow % e->getNumVertices(); + *vR = e->getVertex(ithLocalVertex); *iFieldR = _iField; } -public: - gmshElasticityTerm (GModel *gm, double E, double nu, int iField = 1) : - gmshNodalFemTerm(gm),_E(E),_nu(nu),_iField(iField){} - void elementMatrix ( MElement *e, Double_Matrix & m) const; + public: + gmshElasticityTerm(GModel *gm, double E, double nu, int iField = 1) : + gmshNodalFemTerm(gm), _E(E), _nu(nu), _iField(iField){} + void elementMatrix(MElement *e, Double_Matrix & m) const; }; #endif diff --git a/Numeric/gmshLaplace.h b/Numeric/gmshLaplace.h index 0df7a12b52..0ba9e0afab 100644 --- a/Numeric/gmshLaplace.h +++ b/Numeric/gmshLaplace.h @@ -1,5 +1,6 @@ #ifndef _GMSH_LAPLACE_H_ #define _GMSH_LAPLACE_H_ + #include "gmshTermOfFormulation.h" #include "Gmsh.h" #include "GModel.h" @@ -10,18 +11,19 @@ class gmshLaplaceTerm : public gmshNodalFemTerm { const double _diffusivity; const int _iField ; protected: - virtual int sizeOfR (MElement *e) const { return e->getNumVertices(); } - virtual int sizeOfC (MElement *e) const { return e->getNumVertices(); } - void getLocalDofR (MElement *e, int iRow, MVertex **vR, int *iCompR, int *iFieldR) const + virtual int sizeOfR(MElement *e) const { return e->getNumVertices(); } + virtual int sizeOfC(MElement *e) const { return e->getNumVertices(); } + void getLocalDofR(MElement *e, int iRow, MVertex **vR, int *iCompR, int *iFieldR) const { - *vR = e->getVertex (iRow); + *vR = e->getVertex(iRow); *iCompR = 0; *iFieldR = _iField; } public: - gmshLaplaceTerm (GModel *gm, double diffusivity = 1.0, int iField = 0) : - gmshNodalFemTerm(gm),_diffusivity (diffusivity),_iField(iField){} - void elementMatrix ( MElement *e, Double_Matrix & m) const; + gmshLaplaceTerm(GModel *gm, double diffusivity = 1.0, int iField = 0) : + gmshNodalFemTerm(gm), _diffusivity(diffusivity), _iField(iField){} + void elementMatrix(MElement *e, Double_Matrix &m) const; double getDiffusivity () const { return _diffusivity; } }; + #endif diff --git a/Numeric/gmshTermOfFormulation.h b/Numeric/gmshTermOfFormulation.h index 0c1f8f0f9a..2ddfa7e6e4 100644 --- a/Numeric/gmshTermOfFormulation.h +++ b/Numeric/gmshTermOfFormulation.h @@ -19,9 +19,9 @@ class gmshTermOfFormulation { protected: GModel *_gm; public: - gmshTermOfFormulation (GModel *gm) : _gm(gm) {} - virtual void addToMatrix (gmshAssembler&) const = 0; - virtual void addToRightHandSide (gmshAssembler&) const = 0; + gmshTermOfFormulation(GModel *gm) : _gm(gm) {} + virtual void addToMatrix(gmshAssembler&) const = 0; + virtual void addToRightHandSide(gmshAssembler&) const = 0; }; // a nodal finite element term : variables are always defined at nodes @@ -32,14 +32,17 @@ class gmshNodalFemTerm : public gmshTermOfFormulation { virtual int sizeOfC(MElement*) const = 0; // return the number of rows of the element matrix virtual int sizeOfR(MElement*) const = 0; - // in a given element, return the dof key associated to a given row of the local element matrix - virtual void getLocalDofR (MElement *e, int iRow, MVertex **vR, int *iCompR, int *iFieldR) const = 0; - virtual void getLocalDofC (MElement *e, int iCol, MVertex **vC, int *iCompC, int *iFieldC) const + // in a given element, return the dof key associated to a given row + // of the local element matrix + virtual void getLocalDofR(MElement *e, int iRow, MVertex **vR, + int *iCompR, int *iFieldR) const = 0; + virtual void getLocalDofC(MElement *e, int iCol, MVertex **vC, + int *iCompC, int *iFieldC) const { getLocalDofR(e, iCol, vC, iCompC, iFieldC); } public: - gmshNodalFemTerm (GModel *gm) : gmshTermOfFormulation(gm) {} + gmshNodalFemTerm(GModel *gm) : gmshTermOfFormulation(gm) {} virtual ~gmshNodalFemTerm (); // compute the element matrix virtual void elementMatrix(MElement *e, Double_Matrix &m) const = 0; @@ -50,8 +53,9 @@ class gmshNodalFemTerm : public gmshTermOfFormulation { void addToMatrix(gmshAssembler &J,const std::vector<MElement*> &) const; void addToMatrix(gmshAssembler &Jac, Double_Matrix &localMatrix, MElement *e) const; - void addDirichlet(int physical, int dim, int comp, int field, const gmshFunction & e, gmshAssembler &); - void addNeumann(int physical, int dim, int icomp, int field, const gmshFunction & e, + void addDirichlet(int physical, int dim, int comp, int field, const gmshFunction &e, + gmshAssembler &); + void addNeumann(int physical, int dim, int icomp, int field, const gmshFunction &e, gmshAssembler &); void addToRightHandSide(gmshAssembler &J, GEntity *ge) const; void addToRightHandSide(gmshAssembler &r) const; -- GitLab