mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
baseclass NetgenGeometry
This commit is contained in:
parent
a8ee6ffd81
commit
670509b52b
@ -132,8 +132,24 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern int CSGGenerateMesh (CSGeometry & geom,
|
||||||
|
Mesh *& mesh, int perfstepsstart, int perfstepsend,
|
||||||
|
const char * optstr);
|
||||||
|
|
||||||
|
int CSGeometry :: GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring)
|
||||||
|
{
|
||||||
|
return CSGGenerateMesh (*this, mesh, perfstepsstart, perfstepsend, optstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Refinement & CSGeometry :: GetRefinement () const
|
||||||
|
{
|
||||||
|
// should become class variables
|
||||||
|
RefinementSurfaces * ref = new RefinementSurfaces(*this);
|
||||||
|
ref -> Set2dOptimizer(new MeshOptimize2dSurfaces(*this));
|
||||||
|
return *ref;
|
||||||
|
}
|
||||||
|
|
||||||
class WritePrimitivesIt : public SolidIterator
|
class WritePrimitivesIt : public SolidIterator
|
||||||
{
|
{
|
||||||
|
@ -82,6 +82,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
CSGeometry has the whole geometric information
|
CSGeometry has the whole geometric information
|
||||||
*/
|
*/
|
||||||
@ -303,6 +306,13 @@ public:
|
|||||||
|
|
||||||
Array<BCModification> bcmodifications;
|
Array<BCModification> bcmodifications;
|
||||||
|
|
||||||
|
virtual int GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
virtual const Refinement & GetRefinement () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GenerateMesh (CSGeometry & geom,
|
int CSGGenerateMesh (CSGeometry & geom,
|
||||||
Mesh *& mesh,
|
Mesh *& mesh,
|
||||||
int perfstepsstart, int perfstepsend,
|
int perfstepsstart, int perfstepsend,
|
||||||
const char * optstr)
|
const char * optstr)
|
||||||
|
@ -54,8 +54,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RefinementSurfaces : public Refinement
|
class RefinementSurfaces : public Refinement
|
||||||
{
|
{
|
||||||
const CSGeometry & geometry;
|
const CSGeometry & geometry;
|
||||||
@ -90,6 +88,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ namespace netgen
|
|||||||
|
|
||||||
Revolution :: Revolution(const Point<3> & p0_in,
|
Revolution :: Revolution(const Point<3> & p0_in,
|
||||||
const Point<3> & p1_in,
|
const Point<3> & p1_in,
|
||||||
const SplineGeometry2d & spline_in) :
|
const SplineGeometry<2> & spline_in) :
|
||||||
p0(p0_in), p1(p1_in), splinecurve(spline_in),
|
p0(p0_in), p1(p1_in), splinecurve(spline_in),
|
||||||
nsplines(spline_in.GetNSplines())
|
nsplines(spline_in.GetNSplines())
|
||||||
{
|
{
|
||||||
|
@ -91,7 +91,7 @@ class Revolution : public Primitive
|
|||||||
private:
|
private:
|
||||||
Point<3> p0,p1;
|
Point<3> p0,p1;
|
||||||
Vec<3> v_axis;
|
Vec<3> v_axis;
|
||||||
const SplineGeometry2d & splinecurve;
|
const SplineGeometry<2> & splinecurve;
|
||||||
const int nsplines;
|
const int nsplines;
|
||||||
|
|
||||||
// 1 ... torus-like
|
// 1 ... torus-like
|
||||||
@ -106,7 +106,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Revolution(const Point<3> & p0_in,
|
Revolution(const Point<3> & p0_in,
|
||||||
const Point<3> & p1_in,
|
const Point<3> & p1_in,
|
||||||
const SplineGeometry2d & spline_in);
|
const SplineGeometry<2> & spline_in);
|
||||||
|
|
||||||
~Revolution();
|
~Revolution();
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp moveablemem.hpp parthreads.hpp mpi_interface.hpp
|
noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp parthreads.hpp mpi_interface.hpp
|
||||||
|
|
||||||
|
# moveablemem.hpp
|
||||||
|
|
||||||
include_HEADERS = ngexception.hpp
|
include_HEADERS = ngexception.hpp
|
||||||
|
|
||||||
@ -6,5 +8,7 @@ AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
|
|||||||
METASOURCES = AUTO
|
METASOURCES = AUTO
|
||||||
noinst_LTLIBRARIES = libgeneral.la
|
noinst_LTLIBRARIES = libgeneral.la
|
||||||
libgeneral_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \
|
libgeneral_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \
|
||||||
hashtabl.cpp moveablemem.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \
|
hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \
|
||||||
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp
|
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp
|
||||||
|
|
||||||
|
# moveablemem.cpp
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "ngexception.hpp"
|
#include "ngexception.hpp"
|
||||||
#include "parthreads.hpp"
|
#include "parthreads.hpp"
|
||||||
#include "moveablemem.hpp"
|
// #include "moveablemem.hpp"
|
||||||
#include "dynamicmem.hpp"
|
#include "dynamicmem.hpp"
|
||||||
|
|
||||||
#include "template.hpp"
|
#include "template.hpp"
|
||||||
|
@ -1247,6 +1247,25 @@ string * SplineGeometry<D> :: BCNamePtr( const int bcnr )
|
|||||||
return bcnames[bcnr-1];
|
return bcnames[bcnr-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SplineGeometry2d :: ~SplineGeometry2d()
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SplineGeometry2d :: GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring)
|
||||||
|
{
|
||||||
|
cout << "SplineGeometry2d::GenerateMesh : only a dummy" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Refinement & SplineGeometry2d :: GetRefinement () const
|
||||||
|
{
|
||||||
|
return * new Refinement2d (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template class SplineGeometry<2>;
|
template class SplineGeometry<2>;
|
||||||
|
@ -125,6 +125,8 @@ public:
|
|||||||
string GetBCName ( const int bcnr ) const;
|
string GetBCName ( const int bcnr ) const;
|
||||||
|
|
||||||
string * BCNamePtr ( const int bcnr );
|
string * BCNamePtr ( const int bcnr );
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +136,16 @@ void MeshFromSpline2D (SplineGeometry<2> & geometry,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef SplineGeometry<2> SplineGeometry2d;
|
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~SplineGeometry2d();
|
||||||
|
|
||||||
|
virtual int GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
virtual const Refinement & GetRefinement () const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _FILE_SPLINEGEOMETRY
|
#endif // _FILE_SPLINEGEOMETRY
|
||||||
|
@ -12,6 +12,11 @@ class NetgenGeometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~NetgenGeometry () { ; }
|
virtual ~NetgenGeometry () { ; }
|
||||||
|
|
||||||
|
virtual int GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring) = 0;
|
||||||
|
|
||||||
|
virtual const Refinement & GetRefinement () const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
Refinement ();
|
Refinement ();
|
||||||
virtual ~Refinement ();
|
virtual ~Refinement ();
|
||||||
|
|
||||||
|
void Refine (Mesh & mesh) const;
|
||||||
void Refine (Mesh & mesh);
|
void Refine (Mesh & mesh);
|
||||||
void Bisect (Mesh & mesh, class BisectionOptions & opt, Array<double> * quality_loss = NULL);
|
void Bisect (Mesh & mesh, class BisectionOptions & opt, Array<double> * quality_loss = NULL);
|
||||||
void MakeSecondOrder (Mesh & mesh);
|
void MakeSecondOrder (Mesh & mesh);
|
||||||
|
@ -32,8 +32,6 @@ namespace netgen
|
|||||||
#include "meshing2.hpp"
|
#include "meshing2.hpp"
|
||||||
#include "improve2.hpp"
|
#include "improve2.hpp"
|
||||||
|
|
||||||
#include "basegeom.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "geomsearch.hpp"
|
#include "geomsearch.hpp"
|
||||||
#include "adfront3.hpp"
|
#include "adfront3.hpp"
|
||||||
@ -72,6 +70,8 @@ namespace netgen
|
|||||||
// #include "../parallel/parallelmesh.hpp"
|
// #include "../parallel/parallelmesh.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "basegeom.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void Refinement :: Refine (Mesh & mesh) const
|
||||||
|
{
|
||||||
|
const_cast<Refinement&> (*this).Refine(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Refinement :: Refine (Mesh & mesh)
|
void Refinement :: Refine (Mesh & mesh)
|
||||||
{
|
{
|
||||||
// reduce 2nd order
|
// reduce 2nd order
|
||||||
|
@ -1600,6 +1600,20 @@ namespace netgen
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
int OCCGeometry :: GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring)
|
||||||
|
{
|
||||||
|
return OCCGenerateMesh (*this, mesh, perfstepsstart, perfstepsend, optstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Refinement & OCCGeometry :: GetRefinement () const
|
||||||
|
{
|
||||||
|
return * new OCCRefinementSurfaces (*this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ namespace netgen
|
|||||||
#define OCCGEOMETRYVISUALIZATIONHALFCHANGE 2
|
#define OCCGEOMETRYVISUALIZATIONHALFCHANGE 2
|
||||||
// == redraw
|
// == redraw
|
||||||
|
|
||||||
class OCCGeometry
|
class OCCGeometry : public NetgenGeometry
|
||||||
{
|
{
|
||||||
Point<3> center;
|
Point<3> center;
|
||||||
|
|
||||||
@ -336,6 +336,11 @@ namespace netgen
|
|||||||
bool ErrorInSurfaceMeshing ();
|
bool ErrorInSurfaceMeshing ();
|
||||||
|
|
||||||
void WriteOCC_STL(char * filename);
|
void WriteOCC_STL(char * filename);
|
||||||
|
|
||||||
|
virtual int GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
virtual const Refinement & GetRefinement () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
void PrintContents (OCCGeometry * geom);
|
void PrintContents (OCCGeometry * geom);
|
||||||
|
@ -67,6 +67,20 @@ STLGeometry :: ~STLGeometry()
|
|||||||
delete edgedata;
|
delete edgedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int STLGeometry :: GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring)
|
||||||
|
{
|
||||||
|
return STLMeshingDummy (this, mesh, perfstepsstart, perfstepsend, optstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Refinement & STLGeometry :: GetRefinement () const
|
||||||
|
{
|
||||||
|
return * new RefinementSTLGeometry (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void STLGeometry :: STLInfo(double* data)
|
void STLGeometry :: STLInfo(double* data)
|
||||||
{
|
{
|
||||||
data[0] = GetNT();
|
data[0] = GetNT();
|
||||||
|
@ -436,12 +436,19 @@ namespace netgen
|
|||||||
double gh, double fact, double minh);
|
double gh, double fact, double minh);
|
||||||
|
|
||||||
friend class MeshingSTLSurface;
|
friend class MeshingSTLSurface;
|
||||||
|
|
||||||
|
|
||||||
|
virtual int GenerateMesh (Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
virtual const Refinement & GetRefinement () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include "meshstlsurface.hpp"
|
#include "meshstlsurface.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int STLMeshingDummy (STLGeometry* stlgeometry, Mesh*& mesh,
|
extern int STLMeshingDummy (STLGeometry* stlgeometry, Mesh*& mesh,
|
||||||
int perfstepsstart, int perfstepsend, char* optstring);
|
int perfstepsstart, int perfstepsend, char* optstring);
|
||||||
|
|
||||||
|
222
ng/ngpkg.cpp
222
ng/ngpkg.cpp
@ -178,7 +178,7 @@ namespace netgen
|
|||||||
OCCGeometry * occgeometry = NULL;
|
OCCGeometry * occgeometry = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NetgenGeometry * ng_geometry;
|
||||||
|
|
||||||
Tcl_Interp * tcl_interp;
|
Tcl_Interp * tcl_interp;
|
||||||
|
|
||||||
@ -396,9 +396,6 @@ namespace netgen
|
|||||||
const string filename (argv[1]);
|
const string filename (argv[1]);
|
||||||
PrintMessage (1, "Save mesh to file ", filename);
|
PrintMessage (1, "Save mesh to file ", filename);
|
||||||
|
|
||||||
|
|
||||||
//mesh -> Save (filename);
|
|
||||||
|
|
||||||
ofstream outfile(filename.c_str());
|
ofstream outfile(filename.c_str());
|
||||||
mesh -> Save (outfile);
|
mesh -> Save (outfile);
|
||||||
|
|
||||||
@ -406,7 +403,6 @@ namespace netgen
|
|||||||
|
|
||||||
if (geometry && geometry->GetNSurf()) geometry->SaveSurfaces(outfile);
|
if (geometry && geometry->GetNSurf()) geometry->SaveSurfaces(outfile);
|
||||||
|
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,6 +635,7 @@ namespace netgen
|
|||||||
extern CSGeometry * ParseCSG (istream & istr);
|
extern CSGeometry * ParseCSG (istream & istr);
|
||||||
// ifstream infile(lgfilename);
|
// ifstream infile(lgfilename);
|
||||||
CSGeometry * hgeom = ParseCSG (infile);
|
CSGeometry * hgeom = ParseCSG (infile);
|
||||||
|
ng_geometry = hgeom;
|
||||||
if (hgeom)
|
if (hgeom)
|
||||||
geometry.Reset (hgeom);
|
geometry.Reset (hgeom);
|
||||||
else
|
else
|
||||||
@ -668,6 +665,7 @@ namespace netgen
|
|||||||
// strcpy (geomfilename, lgfilename);
|
// strcpy (geomfilename, lgfilename);
|
||||||
PrintMessage (1, "Load stl geometry file ", lgfilename);
|
PrintMessage (1, "Load stl geometry file ", lgfilename);
|
||||||
stlgeometry = STLGeometry :: Load (infile);
|
stlgeometry = STLGeometry :: Load (infile);
|
||||||
|
ng_geometry = stlgeometry;
|
||||||
stlgeometry->edgesfound = 0;
|
stlgeometry->edgesfound = 0;
|
||||||
}
|
}
|
||||||
else if ((strcmp (&lgfilename[strlen(lgfilename)-4], "iges") == 0) ||
|
else if ((strcmp (&lgfilename[strlen(lgfilename)-4], "iges") == 0) ||
|
||||||
@ -679,6 +677,7 @@ namespace netgen
|
|||||||
// strcpy (geomfilename, lgfilename);
|
// strcpy (geomfilename, lgfilename);
|
||||||
PrintMessage (1, "Load IGES geometry file ", lgfilename);
|
PrintMessage (1, "Load IGES geometry file ", lgfilename);
|
||||||
occgeometry = LoadOCC_IGES (lgfilename);
|
occgeometry = LoadOCC_IGES (lgfilename);
|
||||||
|
ng_geometry = occgeometry;
|
||||||
#else
|
#else
|
||||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||||
"Please install OpenCascade as described in the Netgen-website",
|
"Please install OpenCascade as described in the Netgen-website",
|
||||||
@ -707,6 +706,7 @@ namespace netgen
|
|||||||
// strcpy (geomfilename, lgfilename);
|
// strcpy (geomfilename, lgfilename);
|
||||||
PrintMessage (1, "Load STEP geometry file ", lgfilename);
|
PrintMessage (1, "Load STEP geometry file ", lgfilename);
|
||||||
occgeometry = LoadOCC_STEP (lgfilename);
|
occgeometry = LoadOCC_STEP (lgfilename);
|
||||||
|
ng_geometry = occgeometry;
|
||||||
#else
|
#else
|
||||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||||
"Please install OpenCascade as described in the Netgen-website",
|
"Please install OpenCascade as described in the Netgen-website",
|
||||||
@ -723,6 +723,7 @@ namespace netgen
|
|||||||
// strcpy (geomfilename, lgfilename);
|
// strcpy (geomfilename, lgfilename);
|
||||||
PrintMessage (1, "Load BREP geometry file ", lgfilename);
|
PrintMessage (1, "Load BREP geometry file ", lgfilename);
|
||||||
occgeometry = LoadOCC_BREP (lgfilename);
|
occgeometry = LoadOCC_BREP (lgfilename);
|
||||||
|
ng_geometry = occgeometry;
|
||||||
#else
|
#else
|
||||||
Tcl_SetResult (interp, (char*)"BREP import requires the OpenCascade geometry kernel. "
|
Tcl_SetResult (interp, (char*)"BREP import requires the OpenCascade geometry kernel. "
|
||||||
"Please install OpenCascade as described in the Netgen-website",
|
"Please install OpenCascade as described in the Netgen-website",
|
||||||
@ -737,6 +738,7 @@ namespace netgen
|
|||||||
|
|
||||||
PrintMessage (1, "Load stl geometry file ", lgfilename, " in binary format");
|
PrintMessage (1, "Load stl geometry file ", lgfilename, " in binary format");
|
||||||
stlgeometry = STLGeometry :: LoadBinary (infile);
|
stlgeometry = STLGeometry :: LoadBinary (infile);
|
||||||
|
ng_geometry = stlgeometry;
|
||||||
stlgeometry->edgesfound = 0;
|
stlgeometry->edgesfound = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,6 +748,7 @@ namespace netgen
|
|||||||
|
|
||||||
PrintMessage (1, "Load naomi (F. Kickinger) geometry file ", lgfilename);
|
PrintMessage (1, "Load naomi (F. Kickinger) geometry file ", lgfilename);
|
||||||
stlgeometry = STLGeometry :: LoadNaomi (infile);
|
stlgeometry = STLGeometry :: LoadNaomi (infile);
|
||||||
|
ng_geometry = stlgeometry;
|
||||||
stlgeometry->edgesfound = 0;
|
stlgeometry->edgesfound = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,6 +757,7 @@ namespace netgen
|
|||||||
// strcpy (geomfilename, lgfilename);
|
// strcpy (geomfilename, lgfilename);
|
||||||
geometry2d.Reset (new SplineGeometry2d());
|
geometry2d.Reset (new SplineGeometry2d());
|
||||||
geometry2d -> Load (lgfilename);
|
geometry2d -> Load (lgfilename);
|
||||||
|
ng_geometry = geometry2d.Ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1330,7 +1334,6 @@ namespace netgen
|
|||||||
Tcl_Interp * interp,
|
Tcl_Interp * interp,
|
||||||
int argc, tcl_const char *argv[])
|
int argc, tcl_const char *argv[])
|
||||||
{
|
{
|
||||||
static char buf[100];
|
|
||||||
if (argc < 2) return TCL_ERROR;
|
if (argc < 2) return TCL_ERROR;
|
||||||
|
|
||||||
if (strcmp (argv[1], "usedmb") == 0)
|
if (strcmp (argv[1], "usedmb") == 0)
|
||||||
@ -1602,28 +1605,8 @@ namespace netgen
|
|||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stlgeometry)
|
|
||||||
{
|
|
||||||
RefinementSTLGeometry ref (*stlgeometry);
|
|
||||||
ref.Refine (*mesh);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (geometry2d)
|
|
||||||
{
|
|
||||||
Refinement2d ref (*geometry2d);
|
|
||||||
ref.Refine (*mesh);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
{
|
|
||||||
OCCRefinementSurfaces ref (*occgeometry);
|
|
||||||
ref.Refine (*mesh);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef ACIS
|
#ifdef ACIS
|
||||||
else if (acisgeometry)
|
if (acisgeometry)
|
||||||
{
|
{
|
||||||
ACISRefinementSurfaces ref (*acisgeometry);
|
ACISRefinementSurfaces ref (*acisgeometry);
|
||||||
ACISMeshOptimize2dSurfaces opt(*acisgeometry);
|
ACISMeshOptimize2dSurfaces opt(*acisgeometry);
|
||||||
@ -1633,10 +1616,7 @@ namespace netgen
|
|||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RefinementSurfaces ref (*geometry);
|
ng_geometry -> GetRefinement().Refine(*mesh);
|
||||||
MeshOptimize2dSurfaces opt(*geometry);
|
|
||||||
ref.Set2dOptimizer(&opt);
|
|
||||||
ref.Refine (*mesh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
@ -1657,28 +1637,7 @@ namespace netgen
|
|||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stlgeometry)
|
const_cast<Refinement&> (ng_geometry -> GetRefinement()).MakeSecondOrder (*mesh);
|
||||||
{
|
|
||||||
RefinementSTLGeometry ref (*stlgeometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
{
|
|
||||||
OCCRefinementSurfaces ref (*occgeometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (geometry2d)
|
|
||||||
{
|
|
||||||
Refinement2d ref (*geometry2d);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RefinementSurfaces ref (*geometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
@ -1689,30 +1648,8 @@ namespace netgen
|
|||||||
// mparam.elementorder = atoi (Tcl_GetVar (interp, "options.elementorder", 0));
|
// mparam.elementorder = atoi (Tcl_GetVar (interp, "options.elementorder", 0));
|
||||||
const char * savetask = multithread.task;
|
const char * savetask = multithread.task;
|
||||||
|
|
||||||
Refinement * ref;
|
Refinement & ref = const_cast<Refinement&> (ng_geometry -> GetRefinement());
|
||||||
|
mesh -> GetCurvedElements().BuildCurvedElements (&ref, mparam.elementorder);
|
||||||
if (stlgeometry)
|
|
||||||
ref = new RefinementSTLGeometry (*stlgeometry);
|
|
||||||
else if (geometry2d)
|
|
||||||
ref = new Refinement2d (*geometry2d);
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
ref = new OCCRefinementSurfaces (*occgeometry);
|
|
||||||
#endif
|
|
||||||
#ifdef ACIS
|
|
||||||
else if (acisgeometry)
|
|
||||||
{
|
|
||||||
ref = new ACISRefinementSurfaces(*acisgeometry);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ref = new RefinementSurfaces (*geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
mesh -> GetCurvedElements().BuildCurvedElements (ref, mparam.elementorder);
|
|
||||||
|
|
||||||
delete ref;
|
|
||||||
|
|
||||||
multithread.task = savetask;
|
multithread.task = savetask;
|
||||||
multithread.running = 0;
|
multithread.running = 0;
|
||||||
@ -1826,21 +1763,8 @@ namespace netgen
|
|||||||
int levels = atoi (argv[1]);
|
int levels = atoi (argv[1]);
|
||||||
|
|
||||||
|
|
||||||
Refinement * ref;
|
Refinement & ref = const_cast<Refinement&> (ng_geometry -> GetRefinement());
|
||||||
|
HPRefinement (*mesh, &ref, levels);
|
||||||
if (stlgeometry)
|
|
||||||
ref = new RefinementSTLGeometry (*stlgeometry);
|
|
||||||
else if (geometry2d)
|
|
||||||
ref = new Refinement2d (*geometry2d);
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
ref = new OCCRefinementSurfaces (*occgeometry);
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
ref = new RefinementSurfaces (*geometry);
|
|
||||||
|
|
||||||
|
|
||||||
HPRefinement (*mesh, ref, levels);
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,22 +2081,6 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int GenerateMesh (CSGeometry & geom,
|
|
||||||
Mesh *& mesh, int perfstepsstart, int perfstepsend,
|
|
||||||
const char * optstr);
|
|
||||||
|
|
||||||
extern int STLMeshingDummy (STLGeometry* stlgeometry, Mesh*& mesh,
|
|
||||||
int perfstepsstart, int perfstepsend, char* optstring);
|
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
|
|
||||||
int perfstepsstart, int perfstepsend, char* optstring);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int perfstepsstart;
|
static int perfstepsstart;
|
||||||
static int perfstepsend;
|
static int perfstepsend;
|
||||||
static char* optstring = NULL;
|
static char* optstring = NULL;
|
||||||
@ -2196,29 +2104,14 @@ namespace netgen
|
|||||||
mparam.Print (*logout);
|
mparam.Print (*logout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (stlgeometry)
|
|
||||||
{
|
|
||||||
#ifdef LOG_STREAM
|
|
||||||
(*logout) << "STL parameters:" << endl;
|
|
||||||
stlparam.Print (*logout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
STLMeshingDummy(stlgeometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstring);
|
|
||||||
}
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
{
|
|
||||||
OCCGenerateMesh(*occgeometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstring);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef ACIS
|
#ifdef ACIS
|
||||||
else if (acisgeometry)
|
if (acisgeometry)
|
||||||
{
|
{
|
||||||
ACISGenerateMesh(*acisgeometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstring);
|
ACISGenerateMesh(*acisgeometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstring);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
if (geometry2d)
|
||||||
else if (geometry2d)
|
|
||||||
{
|
{
|
||||||
extern void MeshFromSpline2D (SplineGeometry2d & geometry2d,
|
extern void MeshFromSpline2D (SplineGeometry2d & geometry2d,
|
||||||
Mesh *& mesh, MeshingParameters & mp);
|
Mesh *& mesh, MeshingParameters & mp);
|
||||||
@ -2226,86 +2119,41 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int res =
|
int res = ng_geometry -> GenerateMesh (mesh.Ptr(), perfstepsstart, perfstepsend, optstringcsg);
|
||||||
GenerateMesh (*geometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstringcsg);
|
|
||||||
if (res != MESHING3_OK) return 0;
|
if (res != MESHING3_OK) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(mparam.autozrefine)
|
if (mparam.autozrefine && ( (NetgenGeometry*)geometry.Ptr() == ng_geometry))
|
||||||
{
|
{
|
||||||
ZRefinementOptions opt;
|
ZRefinementOptions opt;
|
||||||
opt.minref = 5;
|
opt.minref = 5;
|
||||||
ZRefinement (*mesh, geometry.Ptr(), opt);
|
ZRefinement (*mesh, geometry.Ptr(), opt);
|
||||||
|
mesh -> SetNextMajorTimeStamp();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mparam.secondorder)
|
if (mparam.secondorder)
|
||||||
{
|
{
|
||||||
if (stlgeometry)
|
const_cast<Refinement&> (ng_geometry -> GetRefinement()).MakeSecondOrder (*mesh);
|
||||||
{
|
mesh -> SetNextMajorTimeStamp();
|
||||||
RefinementSTLGeometry ref (*stlgeometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
{
|
|
||||||
OCCRefinementSurfaces ref (*occgeometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (geometry2d)
|
|
||||||
{
|
|
||||||
Refinement2d ref (*geometry2d);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RefinementSurfaces ref (*geometry);
|
|
||||||
ref.MakeSecondOrder (*mesh);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mparam.elementorder > 1)
|
if (mparam.elementorder > 1)
|
||||||
{
|
{
|
||||||
|
mesh -> GetCurvedElements().BuildCurvedElements (&const_cast<Refinement&> (ng_geometry -> GetRefinement()),
|
||||||
Refinement * ref;
|
mparam.elementorder);
|
||||||
|
|
||||||
if (stlgeometry)
|
|
||||||
ref = new RefinementSTLGeometry (*stlgeometry);
|
|
||||||
else if (geometry2d)
|
|
||||||
ref = new Refinement2d (*geometry2d);
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
else if (occgeometry)
|
|
||||||
ref = new OCCRefinementSurfaces (*occgeometry);
|
|
||||||
#endif
|
|
||||||
#ifdef ACIS
|
|
||||||
else if (acisgeometry)
|
|
||||||
ref = new ACISRefinementSurfaces(*acisgeometry);
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
ref = new RefinementSurfaces (*geometry);
|
|
||||||
|
|
||||||
|
|
||||||
mesh -> GetCurvedElements().BuildCurvedElements (ref, mparam.elementorder);
|
|
||||||
|
|
||||||
// cout << "WARNING: Ng_HighOrder! ref is not deleted for edge projection visualization" << endl;
|
|
||||||
|
|
||||||
delete ref;
|
|
||||||
|
|
||||||
mesh -> SetNextMajorTimeStamp();
|
mesh -> SetNextMajorTimeStamp();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrintMessage (1, "Meshing done, time = ", GetTime(), " sec");
|
PrintMessage (1, "Meshing done, time = ", GetTime(), " sec");
|
||||||
#ifdef LOG_STREAM
|
|
||||||
(*logout) << "Meshing done, time = " << GetTime() << endl;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (NgException e)
|
catch (NgException e)
|
||||||
{
|
{
|
||||||
cout << e.What() << endl;
|
cout << e.What() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
multithread.task = savetask;
|
multithread.task = savetask;
|
||||||
multithread.running = 0;
|
multithread.running = 0;
|
||||||
|
|
||||||
@ -5306,15 +5154,3 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace netgen {
|
|
||||||
extern CSGeometry * ParseCSG (istream & istr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Netgen_Test ()
|
|
||||||
{
|
|
||||||
ifstream infile ("examples/cube.geo");
|
|
||||||
netgen::geometry.Reset (netgen::ParseCSG (infile) );
|
|
||||||
netgen:: geometry -> FindIdenticSurfaces(1e-10);
|
|
||||||
netgen::GenerateMesh (*netgen::geometry.Ptr(), netgen::mesh.Ptr(), 1, 6, "");
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user