mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +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
|
||||
{
|
||||
|
@ -82,6 +82,9 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
CSGeometry has the whole geometric information
|
||||
*/
|
||||
@ -303,6 +306,13 @@ public:
|
||||
|
||||
Array<BCModification> bcmodifications;
|
||||
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -662,10 +662,10 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int GenerateMesh (CSGeometry & geom,
|
||||
Mesh *& mesh,
|
||||
int perfstepsstart, int perfstepsend,
|
||||
const char * optstr)
|
||||
int CSGGenerateMesh (CSGeometry & geom,
|
||||
Mesh *& mesh,
|
||||
int perfstepsstart, int perfstepsend,
|
||||
const char * optstr)
|
||||
{
|
||||
if (mesh && mesh->GetNSE() &&
|
||||
!geom.GetNSolids())
|
||||
|
@ -54,8 +54,6 @@ public:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class RefinementSurfaces : public Refinement
|
||||
{
|
||||
const CSGeometry & geometry;
|
||||
@ -90,6 +88,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -590,7 +590,7 @@ namespace netgen
|
||||
|
||||
Revolution :: Revolution(const Point<3> & p0_in,
|
||||
const Point<3> & p1_in,
|
||||
const SplineGeometry2d & spline_in) :
|
||||
const SplineGeometry<2> & spline_in) :
|
||||
p0(p0_in), p1(p1_in), splinecurve(spline_in),
|
||||
nsplines(spline_in.GetNSplines())
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ class Revolution : public Primitive
|
||||
private:
|
||||
Point<3> p0,p1;
|
||||
Vec<3> v_axis;
|
||||
const SplineGeometry2d & splinecurve;
|
||||
const SplineGeometry<2> & splinecurve;
|
||||
const int nsplines;
|
||||
|
||||
// 1 ... torus-like
|
||||
@ -106,7 +106,7 @@ private:
|
||||
public:
|
||||
Revolution(const Point<3> & p0_in,
|
||||
const Point<3> & p1_in,
|
||||
const SplineGeometry2d & spline_in);
|
||||
const SplineGeometry<2> & spline_in);
|
||||
|
||||
~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
|
||||
|
||||
@ -6,5 +8,7 @@ AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
|
||||
METASOURCES = AUTO
|
||||
noinst_LTLIBRARIES = libgeneral.la
|
||||
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
|
||||
|
||||
# moveablemem.cpp
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "ngexception.hpp"
|
||||
#include "parthreads.hpp"
|
||||
#include "moveablemem.hpp"
|
||||
// #include "moveablemem.hpp"
|
||||
#include "dynamicmem.hpp"
|
||||
|
||||
#include "template.hpp"
|
||||
|
@ -1247,6 +1247,25 @@ string * SplineGeometry<D> :: BCNamePtr( const int bcnr )
|
||||
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>;
|
||||
|
@ -125,6 +125,8 @@ public:
|
||||
string GetBCName ( const int bcnr ) const;
|
||||
|
||||
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
|
||||
|
@ -12,6 +12,11 @@ class NetgenGeometry
|
||||
{
|
||||
public:
|
||||
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 ();
|
||||
virtual ~Refinement ();
|
||||
|
||||
void Refine (Mesh & mesh) const;
|
||||
void Refine (Mesh & mesh);
|
||||
void Bisect (Mesh & mesh, class BisectionOptions & opt, Array<double> * quality_loss = NULL);
|
||||
void MakeSecondOrder (Mesh & mesh);
|
||||
|
@ -32,8 +32,6 @@ namespace netgen
|
||||
#include "meshing2.hpp"
|
||||
#include "improve2.hpp"
|
||||
|
||||
#include "basegeom.hpp"
|
||||
|
||||
|
||||
#include "geomsearch.hpp"
|
||||
#include "adfront3.hpp"
|
||||
@ -72,6 +70,8 @@ namespace netgen
|
||||
// #include "../parallel/parallelmesh.hpp"
|
||||
#endif
|
||||
|
||||
#include "basegeom.hpp"
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,13 @@
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
void Refinement :: Refine (Mesh & mesh) const
|
||||
{
|
||||
const_cast<Refinement&> (*this).Refine(mesh);
|
||||
}
|
||||
|
||||
|
||||
void Refinement :: Refine (Mesh & mesh)
|
||||
{
|
||||
// reduce 2nd order
|
||||
|
@ -1600,6 +1600,20 @@ namespace netgen
|
||||
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
|
||||
// == redraw
|
||||
|
||||
class OCCGeometry
|
||||
class OCCGeometry : public NetgenGeometry
|
||||
{
|
||||
Point<3> center;
|
||||
|
||||
@ -336,6 +336,11 @@ namespace netgen
|
||||
bool ErrorInSurfaceMeshing ();
|
||||
|
||||
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);
|
||||
|
@ -67,6 +67,20 @@ STLGeometry :: ~STLGeometry()
|
||||
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)
|
||||
{
|
||||
data[0] = GetNT();
|
||||
|
@ -436,12 +436,19 @@ namespace netgen
|
||||
double gh, double fact, double minh);
|
||||
|
||||
friend class MeshingSTLSurface;
|
||||
|
||||
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
||||
|
||||
#include "meshstlsurface.hpp"
|
||||
|
||||
|
||||
|
||||
extern int STLMeshingDummy (STLGeometry* stlgeometry, Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
|
252
ng/ngpkg.cpp
252
ng/ngpkg.cpp
@ -178,7 +178,7 @@ namespace netgen
|
||||
OCCGeometry * occgeometry = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
NetgenGeometry * ng_geometry;
|
||||
|
||||
Tcl_Interp * tcl_interp;
|
||||
|
||||
@ -396,9 +396,6 @@ namespace netgen
|
||||
const string filename (argv[1]);
|
||||
PrintMessage (1, "Save mesh to file ", filename);
|
||||
|
||||
|
||||
//mesh -> Save (filename);
|
||||
|
||||
ofstream outfile(filename.c_str());
|
||||
mesh -> Save (outfile);
|
||||
|
||||
@ -406,7 +403,6 @@ namespace netgen
|
||||
|
||||
if (geometry && geometry->GetNSurf()) geometry->SaveSurfaces(outfile);
|
||||
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@ -639,6 +635,7 @@ namespace netgen
|
||||
extern CSGeometry * ParseCSG (istream & istr);
|
||||
// ifstream infile(lgfilename);
|
||||
CSGeometry * hgeom = ParseCSG (infile);
|
||||
ng_geometry = hgeom;
|
||||
if (hgeom)
|
||||
geometry.Reset (hgeom);
|
||||
else
|
||||
@ -668,6 +665,7 @@ namespace netgen
|
||||
// strcpy (geomfilename, lgfilename);
|
||||
PrintMessage (1, "Load stl geometry file ", lgfilename);
|
||||
stlgeometry = STLGeometry :: Load (infile);
|
||||
ng_geometry = stlgeometry;
|
||||
stlgeometry->edgesfound = 0;
|
||||
}
|
||||
else if ((strcmp (&lgfilename[strlen(lgfilename)-4], "iges") == 0) ||
|
||||
@ -679,6 +677,7 @@ namespace netgen
|
||||
// strcpy (geomfilename, lgfilename);
|
||||
PrintMessage (1, "Load IGES geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_IGES (lgfilename);
|
||||
ng_geometry = occgeometry;
|
||||
#else
|
||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||
"Please install OpenCascade as described in the Netgen-website",
|
||||
@ -707,6 +706,7 @@ namespace netgen
|
||||
// strcpy (geomfilename, lgfilename);
|
||||
PrintMessage (1, "Load STEP geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_STEP (lgfilename);
|
||||
ng_geometry = occgeometry;
|
||||
#else
|
||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||
"Please install OpenCascade as described in the Netgen-website",
|
||||
@ -723,6 +723,7 @@ namespace netgen
|
||||
// strcpy (geomfilename, lgfilename);
|
||||
PrintMessage (1, "Load BREP geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_BREP (lgfilename);
|
||||
ng_geometry = occgeometry;
|
||||
#else
|
||||
Tcl_SetResult (interp, (char*)"BREP import requires the OpenCascade geometry kernel. "
|
||||
"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");
|
||||
stlgeometry = STLGeometry :: LoadBinary (infile);
|
||||
ng_geometry = stlgeometry;
|
||||
stlgeometry->edgesfound = 0;
|
||||
}
|
||||
|
||||
@ -746,6 +748,7 @@ namespace netgen
|
||||
|
||||
PrintMessage (1, "Load naomi (F. Kickinger) geometry file ", lgfilename);
|
||||
stlgeometry = STLGeometry :: LoadNaomi (infile);
|
||||
ng_geometry = stlgeometry;
|
||||
stlgeometry->edgesfound = 0;
|
||||
}
|
||||
|
||||
@ -754,6 +757,7 @@ namespace netgen
|
||||
// strcpy (geomfilename, lgfilename);
|
||||
geometry2d.Reset (new SplineGeometry2d());
|
||||
geometry2d -> Load (lgfilename);
|
||||
ng_geometry = geometry2d.Ptr();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1330,7 +1334,6 @@ namespace netgen
|
||||
Tcl_Interp * interp,
|
||||
int argc, tcl_const char *argv[])
|
||||
{
|
||||
static char buf[100];
|
||||
if (argc < 2) return TCL_ERROR;
|
||||
|
||||
if (strcmp (argv[1], "usedmb") == 0)
|
||||
@ -1459,7 +1462,7 @@ namespace netgen
|
||||
|
||||
if (!occgeometry)
|
||||
{
|
||||
Tcl_SetResult (interp, (char *)"Ng_SurfaceMeshSize currently supports only OCC (STEP/IGES) Files", TCL_STATIC);
|
||||
Tcl_SetResult (interp, (char *)"Ng_SurfaceMeshSize currently supports only OCC (STEP/IGES) Files", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@ -1602,28 +1605,8 @@ namespace netgen
|
||||
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
|
||||
else if (acisgeometry)
|
||||
if (acisgeometry)
|
||||
{
|
||||
ACISRefinementSurfaces ref (*acisgeometry);
|
||||
ACISMeshOptimize2dSurfaces opt(*acisgeometry);
|
||||
@ -1633,10 +1616,7 @@ namespace netgen
|
||||
#endif
|
||||
else
|
||||
{
|
||||
RefinementSurfaces ref (*geometry);
|
||||
MeshOptimize2dSurfaces opt(*geometry);
|
||||
ref.Set2dOptimizer(&opt);
|
||||
ref.Refine (*mesh);
|
||||
ng_geometry -> GetRefinement().Refine(*mesh);
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
@ -1656,29 +1636,8 @@ namespace netgen
|
||||
Tcl_SetResult (interp, err_jobrunning, TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (stlgeometry)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
const_cast<Refinement&> (ng_geometry -> GetRefinement()).MakeSecondOrder (*mesh);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
@ -1689,30 +1648,8 @@ namespace netgen
|
||||
// mparam.elementorder = atoi (Tcl_GetVar (interp, "options.elementorder", 0));
|
||||
const char * savetask = multithread.task;
|
||||
|
||||
Refinement * ref;
|
||||
|
||||
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;
|
||||
Refinement & ref = const_cast<Refinement&> (ng_geometry -> GetRefinement());
|
||||
mesh -> GetCurvedElements().BuildCurvedElements (&ref, mparam.elementorder);
|
||||
|
||||
multithread.task = savetask;
|
||||
multithread.running = 0;
|
||||
@ -1826,21 +1763,8 @@ namespace netgen
|
||||
int levels = atoi (argv[1]);
|
||||
|
||||
|
||||
Refinement * ref;
|
||||
|
||||
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);
|
||||
Refinement & ref = const_cast<Refinement&> (ng_geometry -> GetRefinement());
|
||||
HPRefinement (*mesh, &ref, levels);
|
||||
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 perfstepsend;
|
||||
static char* optstring = NULL;
|
||||
@ -2196,116 +2104,56 @@ namespace netgen
|
||||
mparam.Print (*logout);
|
||||
#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
|
||||
else if (acisgeometry)
|
||||
if (acisgeometry)
|
||||
{
|
||||
ACISGenerateMesh(*acisgeometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstring);
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (geometry2d)
|
||||
{
|
||||
extern void MeshFromSpline2D (SplineGeometry2d & geometry2d,
|
||||
Mesh *& mesh, MeshingParameters & mp);
|
||||
MeshFromSpline2D (*geometry2d, mesh.Ptr(), mparam);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (geometry2d)
|
||||
{
|
||||
extern void MeshFromSpline2D (SplineGeometry2d & geometry2d,
|
||||
Mesh *& mesh, MeshingParameters & mp);
|
||||
MeshFromSpline2D (*geometry2d, mesh.Ptr(), mparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
int res = ng_geometry -> GenerateMesh (mesh.Ptr(), perfstepsstart, perfstepsend, optstringcsg);
|
||||
if (res != MESHING3_OK) return 0;
|
||||
}
|
||||
|
||||
if (mparam.autozrefine && ( (NetgenGeometry*)geometry.Ptr() == ng_geometry))
|
||||
{
|
||||
int res =
|
||||
GenerateMesh (*geometry, mesh.Ptr(), perfstepsstart, perfstepsend, optstringcsg);
|
||||
if (res != MESHING3_OK) return 0;
|
||||
|
||||
if(mparam.autozrefine)
|
||||
{
|
||||
ZRefinementOptions opt;
|
||||
opt.minref = 5;
|
||||
ZRefinement (*mesh, geometry.Ptr(), opt);
|
||||
}
|
||||
ZRefinementOptions opt;
|
||||
opt.minref = 5;
|
||||
ZRefinement (*mesh, geometry.Ptr(), opt);
|
||||
mesh -> SetNextMajorTimeStamp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (mparam.secondorder)
|
||||
{
|
||||
if (stlgeometry)
|
||||
{
|
||||
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);
|
||||
}
|
||||
const_cast<Refinement&> (ng_geometry -> GetRefinement()).MakeSecondOrder (*mesh);
|
||||
mesh -> SetNextMajorTimeStamp();
|
||||
}
|
||||
|
||||
if (mparam.elementorder > 1)
|
||||
{
|
||||
|
||||
Refinement * ref;
|
||||
|
||||
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 -> GetCurvedElements().BuildCurvedElements (&const_cast<Refinement&> (ng_geometry -> GetRefinement()),
|
||||
mparam.elementorder);
|
||||
|
||||
mesh -> SetNextMajorTimeStamp();
|
||||
|
||||
}
|
||||
|
||||
|
||||
PrintMessage (1, "Meshing done, time = ", GetTime(), " sec");
|
||||
#ifdef LOG_STREAM
|
||||
(*logout) << "Meshing done, time = " << GetTime() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
catch (NgException e)
|
||||
{
|
||||
cout << e.What() << endl;
|
||||
}
|
||||
|
||||
multithread.task = savetask;
|
||||
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