// ORIG-DATE: Dec 2007 // -*- Mode : c++ -*- // // SUMMARY : Model mesh curve 3d // USAGE : LGPL // ORG : LJLL Universite Pierre et Marie Curi, Paris, FRANCE // AUTHOR : Frederic Hecht // E-MAIL : frederic.hecht@ann.jussieu.fr // /* This file is part of Freefem++ Freefem++ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Freefem++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Freefem++; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Thank to the ARN () FF2A3 grant ref:ANR-07-CIS7-002-01 */ #ifndef MESHLN_HPP_ #define MESHLN_HPP_ #include // definition R #include namespace Fem2D { #include "R3.hpp" #include "R2.hpp" #include "R1.hpp" } using namespace ::std; #include "GenericMesh.hpp" //#include "MeshSn.hpp" namespace Fem2D { typedef GenericVertex Vertex3; inline void Add(int *p,int n,int o) { for(int i=0;i { public: BoundaryPointL() {} // constructor empty for array Rd operator()(R0) const {return this->at(0); } }; class EdgeL: public GenericElement { public: EdgeL() {} // constructor empty for array R1 H(int i) const { ASSERTION(i>=0 && i <1); return (2-i)/mesure();} // heigth void Gradlambda(R3 * GradL) const { R3 V(at(0),at(1)); GradL[1]= V/(V.norme2()); GradL[0]= -GradL[1]; } R3 NormalT() const { R3 V(at(0),at(1)); ffassert(V.x != 0 || V.y != 0); R3 N = V^R3(0,0,1); return N; } R3 NormalTUnitaire() const { R3 V(at(0),at(1)); ffassert(V.x != 0 || V.y != 0); R3 N = V^R3(0,0,1); return N/N.norme(); } R3 TangenteUnitaire() const { R3 V(at(0),at(1)); //ffassert(V.x != 0 || V.y != 0); R3 N = V; return N/N.norme(); } R3 n(int i) const// Add jan 2022 FH { R3 Tg = TangenteUnitaire(); if( i==0) Tg = -Tg; return Tg;} // exterior normal }; template void GSave2(FILE * ff,const Mesh & Th) ; class MeshL : public GenericMesh { public: // mapping for surface/line vertices int *mapSurf2Curv; int *mapCurv2Surf; MeshL():mapSurf2Curv(nullptr),mapCurv2Surf(nullptr) {} MeshL(const string); MeshL(const string filename, bool cleanmesh, bool removeduplicate=false, bool rebuildboundary=false, int orientation=1, double precis_mesh=1e-7, bool labeledBoundary=false, double ridgeangledetection=8.*atan(1.)/9.); void read(istream &f); void readmsh(ifstream & f,int offset); MeshL(FILE *f,int offset=0); MeshL(int nnv, int nnt, int nnbe, Vertex3 *vv, EdgeL *tt, BoundaryPointL *bb, bool cleanmesh=false, bool removeduplicate=false, bool rebuildboundary=false, int orientation=1, double precis_mesh=1e-7, bool labeledBoundary=false, double ridgeangledetection=8.*atan(1.)/9.); MeshL(const Serialize&); int load(const string & filename); const Element * Find( Rd P, R1 & Phat,bool & outside,const Element * tstart=nullptr) const; int Save(const string & filename) const; //void flipSurfaceMeshS(int surface_orientation); void GSave(FILE * f,int offset=0) const ; void GRead(FILE * f,int offset); double hmin() const; //int Save(const string & filename) const; //Serialize serialize_withBorderMesh() const; void BuildBdElem(bool labeledBoundary=false, const double angle=8.*atan(1.)/9.); // default angle = 40 deg and only true boundaries; void BuildCurvBasis(); ~MeshL() { delete [] mapSurf2Curv ; delete [] mapCurv2Surf ; SHOWVERB(cout << " %%%% delete MeshL"<< this << endl) ; } private: MeshL(const MeshL &); // pas de construction par copie void operator=(const MeshL &);// pas affectation par copy }; template<> const int (* const GenericElement::nvface)[3]; template<> const int (* const GenericElement::nvedge)[2]; template<> const int (* const GenericElement::nvadj)[1]; template<> const int GenericElement::nitemdim[4]; template<> const int (* const GenericElement::onWhatBorder)[3]; } #endif