diff --git a/contrib/arc/highlevel.h b/contrib/arc/highlevel.h index bbe919d35e7ab788f732bf1b25e9fc291d385424..8ed6d0ab493de289190a13368d91a1b63af9c6a0 100644 --- a/contrib/arc/highlevel.h +++ b/contrib/arc/highlevel.h @@ -31,20 +31,24 @@ template<class T> struct TensorialTraits typedef T ValType; typedef T GradType[3]; typedef T HessType[3][3]; + static const int nb_basis_vectors=1; // par défaut considéré comme un scalaire }; -/*template<> struct TensorialTraits<double> +template<> struct TensorialTraits<double> { typedef double ValType; typedef Vector GradType; typedef Tensor2 HessType; + static const int nb_basis_vectors=1; // scalaire }; +/* template<> struct TensorialTraits<Vector> { typedef Vector ValType; typedef Tensor2 GradType; typedef Tensor3 HessType; + static const int nb_basis_vectors=3; // trois vecteurs de base linéairement indépendants. }; */ @@ -61,7 +65,7 @@ public: class SpaceBase // renvoie des clefs de dofs { public: - virtual void getDofs(MElement *e,std::vector<Dof> &vecD){};//=0; + virtual void getDofs(MElement *e,std::vector<Dof> &vecD)=0; }; template<class T> class Space : public SpaceBase // renvoie des clefs de dofs et des fonctions de formes @@ -74,6 +78,32 @@ public: }; +template<class T> class SpaceLagrange : public Space<T> // approximation Lagrange ... +{ +private: + int _iField; + Dof getLocalDof(MElement *e, int i) const + { + int iComp = i / e->getNumVertices(); + int ithLocalVertex = i % e->getNumVertices(); + return Dof(e->getVertex(ithLocalVertex)->getNum(), + Dof::createTypeWithTwoInts(iComp, _iField)); + } + +public: + SpaceLagrange(int iField):_iField(iField){}; + virtual ~SpaceLagrange(){}; + virtual void getDofsandSFs(MElement *e,std::vector<std::pair< Dof, Function<T>* > > &vecDFF){} + virtual void getSFs(std::vector<std::pair< Dof, Function<T>* > > &vecDFF){};//=0; + virtual void getDofs(MElement *e,std::vector<Dof> &vecD) + { + int ndofs= e->getNumVertices()*TensorialTraits<T>::nb_basis_vectors; + for (int i=0;i<ndofs;++i) + vecD.push_back(getLocalDof(e,i)); + } +}; + + template<class T> class Field : public Function<T> // renvoie des valeurs de champ (ff*valeurs dofs), gradient , etc... { public: diff --git a/contrib/arc/mainElasticity.cpp b/contrib/arc/mainElasticity.cpp index 5edae94b705e06246349e8c96af4d98c98fa1be5..e39b9fe4118b9e1d338f93d22a1881b111f6991d 100644 --- a/contrib/arc/mainElasticity.cpp +++ b/contrib/arc/mainElasticity.cpp @@ -21,7 +21,7 @@ int main (int argc, char* argv[]) fnl.func(); fnl.func2(); - + SpaceLagrange<double> L(123); // globals are still present in Gmsh GmshInitialize(argc, argv);