Skip to content
Snippets Groups Projects
Commit 8427807f authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent 6c90cc4c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
#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
#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
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment