1 // ORIG-DATE: Dec 2007 2 // -*- Mode : c++ -*- 3 // 4 // SUMMARY : Model mesh 1d 5 // USAGE : LGPL 6 // ORG : LJLL Universite Pierre et Marie Curi, Paris, FRANCE 7 // AUTHOR : Frederic Hecht 8 // E-MAIL : frederic.hecht@ann.jussieu.fr 9 // 10 11 /* 12 13 This file is part of Freefem++ 14 15 Freefem++ is free software; you can redistribute it and/or modify 16 it under the terms of the GNU Lesser General Public License as published by 17 the Free Software Foundation; either version 2.1 of the License, or 18 (at your option) any later version. 19 20 Freefem++ is distributed in the hope that it will be useful, 21 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 GNU Lesser General Public License for more details. 24 25 You should have received a copy of the GNU Lesser General Public License 26 along with Freefem++; if not, write to the Free Software 27 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 28 29 Thank to the ARN () FF2A3 grant 30 ref:ANR-07-CIS7-002-01 31 */ 32 33 #ifndef MESH1DN_HPP_ 34 #define MESH1DN_HPP_ 35 36 namespace Fem2D { 37 #include "R1.hpp" 38 } 39 40 #include "GenericMesh.hpp" 41 #include <cstdlib> 42 using namespace std; 43 44 namespace Fem2D { 45 46 typedef GenericVertex<R1> Vertex1; 47 48 struct DataSeg1 { 49 static const int NbOfVertices =2; 50 static const int NbOfFaces =0; 51 static const int NbOfEdges =1; 52 static const int NT =0; 53 static const int NbOfAdjElem =NbOfVertices; 54 static const int NbOfVertexOnHyperFace =NbOfVertices-1; 55 typedef Vertex1 V; 56 typedef V::Rd Rd ; mesureFem2D::DataSeg157 static R mesure( V * pv[NbOfVertices]) { 58 return pv[1]->x-pv[0]->x; 59 } 60 typedef R0 RdHatBord; 61 typedef R1 RdHat; PBordFem2D::DataSeg162 static RdHat PBord(const int * nvb,const RdHatBord & P) { return R1(*nvb) ;} 63 // static const int (* const nvface)[3];// = nvfaceTria ; 64 //static const int (* const nvedge)[2];// = nvedgeTrai; 65 66 }; 67 68 69 struct DataPoint1 { 70 static const int NbOfVertices =1; 71 static const int NbOfEdges =0; 72 static const int NbOfFaces =0; 73 static const int NT =0; 74 static const int NbOfAdjElem =1; 75 static const int NbOfVertexOnHyperFace =1; 76 typedef Vertex1 V; 77 typedef V::Rd Rd; mesureFem2D::DataPoint178 static R mesure( V * pv[NbOfVertices] ) { 79 return 1.; 80 } 81 typedef R0 RdHatBord; 82 typedef R0 RdHat; PBordFem2D::DataPoint183 static RdHat PBord(const int * nvb,const RdHatBord & P) { return R0() ;} 84 85 }; 86 87 88 89 class Seg1: public GenericElement<DataSeg1> { 90 public: Seg1()91 Seg1() {}; // constructor empty for array 92 93 H(int i) const94 R1 H(int i) const { ASSERTION(i>=0 && i <1); 95 return (2-i)/mesure();} // heigth 96 Gradlambda(R1 * GradL) const97 void Gradlambda(R1 * GradL) const 98 { 99 GradL[1]= H(1); 100 GradL[0]=-GradL[1]; 101 } 102 103 104 105 }; 106 107 class BoundaryPoint1: public GenericElement<DataPoint1> { 108 public: BoundaryPoint1()109 BoundaryPoint1() {}; // constructor empty for array 110 111 112 }; 113 114 115 class Mesh1 : public GenericMesh<Seg1,BoundaryPoint1,Vertex1> { 116 public: 117 Mesh1(const char *); // 118 const Element * Find( R1 P, R1 & Phat,bool & outside,const Element * tstart) const; 119 private: 120 int load(const string & filename); 121 Mesh1(const Mesh1 &); // pas de construction par copie 122 void operator=(const Mesh1 &);// pas affectation par copy 123 }; 124 } 125 #endif 126 127