mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
picking geometry with mesh (CSG only by now)
This commit is contained in:
parent
ec1bcd8799
commit
d9219e6f05
@ -19,6 +19,6 @@ endif(USE_GUI)
|
|||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
geom2dmesh.hpp geometry2d.hpp spline2d.hpp
|
geom2dmesh.hpp geometry2d.hpp spline2d.hpp
|
||||||
splinegeometry2.hpp vsgeom2d.hpp
|
vsgeom2d.hpp
|
||||||
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/geom2d COMPONENT netgen_devel
|
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/geom2d COMPONENT netgen_devel
|
||||||
)
|
)
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
OLD IMPLEMENTATION, NOT USED ANYMORE!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FILE_SPLINEGEOMETRY2
|
|
||||||
#define FILE_SPLINEGEOMETRY2
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* File: splinegeometry2.hpp */
|
|
||||||
/* Author: Joachim Schoeberl */
|
|
||||||
/* Date: 24. Jul. 96 */
|
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
#include "splinegeometry.hpp"
|
|
||||||
|
|
||||||
#ifdef OLDSPLINEGEOMETRY
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
extern void LoadBoundarySplines (const char * filename,
|
|
||||||
Array<GeomPoint2d> & geompoints,
|
|
||||||
Array<SplineSegment*> & splines,
|
|
||||||
double & elto0);
|
|
||||||
///
|
|
||||||
extern void PartitionBoundary (const Array<SplineSegment*> & splines,
|
|
||||||
double h, double elto0,
|
|
||||||
Mesh & mesh2d);
|
|
||||||
|
|
||||||
|
|
||||||
class CSGScanner;
|
|
||||||
|
|
||||||
class SplineGeometry2d
|
|
||||||
{
|
|
||||||
Array<GeomPoint2d> geompoints;
|
|
||||||
Array<SplineSegment*> splines;
|
|
||||||
double elto0;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
void AppendSegment(SplineSegment * spline, const int leftdomain, const int rightdomain,
|
|
||||||
const int bc,
|
|
||||||
const double reffac, const bool hprefleft, const bool hprefright,
|
|
||||||
const int copyfrom);
|
|
||||||
|
|
||||||
public:
|
|
||||||
~SplineGeometry2d();
|
|
||||||
|
|
||||||
void Load (const char * filename);
|
|
||||||
void CSGLoad (CSGScanner & scan);
|
|
||||||
void PartitionBoundary (double h, Mesh & mesh2d);
|
|
||||||
|
|
||||||
void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);
|
|
||||||
|
|
||||||
const Array<SplineSegment*> & GetSplines () const
|
|
||||||
{ return splines; }
|
|
||||||
|
|
||||||
int GetNSplines (void) const { return splines.Size(); }
|
|
||||||
string GetSplineType (const int i) const { return splines[i]->GetType(); }
|
|
||||||
SplineSegment & GetSpline (const int i) {return *splines[i];}
|
|
||||||
const SplineSegment & GetSpline (const int i) const {return *splines[i];}
|
|
||||||
|
|
||||||
void GetBoundingBox (Box<2> & box) const;
|
|
||||||
|
|
||||||
int GetNP () const { return geompoints.Size(); }
|
|
||||||
const GeomPoint2d & GetPoint(int i) const { return geompoints[i]; }
|
|
||||||
|
|
||||||
void SetGrading (const double grading);
|
|
||||||
void AppendPoint (const double x, const double y, const double reffac = 1., const bool hpref = false);
|
|
||||||
|
|
||||||
void AppendLineSegment (const int n1, const int n2,
|
|
||||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
||||||
const double reffac = 1.,
|
|
||||||
const bool hprefleft = false, const bool hprefright = false,
|
|
||||||
const int copyfrom = -1);
|
|
||||||
void AppendSplineSegment (const int n1, const int n2, const int n3,
|
|
||||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
||||||
const double reffac = 1.,
|
|
||||||
const bool hprefleft = false, const bool hprefright = false,
|
|
||||||
const int copyfrom = -1);
|
|
||||||
void AppendCircleSegment (const int n1, const int n2, const int n3,
|
|
||||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
||||||
const double reffac = 1.,
|
|
||||||
const bool hprefleft = false, const bool hprefright = false,
|
|
||||||
const int copyfrom = -1);
|
|
||||||
void AppendDiscretePointsSegment (const Array< Point<2> > & points,
|
|
||||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
||||||
const double reffac = 1.,
|
|
||||||
const bool hprefleft = false, const bool hprefright = false,
|
|
||||||
const int copyfrom = -1);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void MeshFromSpline2D (SplineGeometry2d & geometry,
|
|
||||||
shared_ptr<Mesh> & mesh,
|
|
||||||
MeshingParameters & mp);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -11,6 +11,17 @@ namespace netgen
|
|||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
shared_ptr<NetgenGeometry> GeometryRegisterArray :: LoadFromMeshFile (istream & ist) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Size(); i++)
|
||||||
|
{
|
||||||
|
NetgenGeometry * hgeom = (*this)[i]->LoadFromMeshFile (ist);
|
||||||
|
if (hgeom)
|
||||||
|
return shared_ptr<NetgenGeometry>(hgeom);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ namespace netgen
|
|||||||
for (int i = 0; i < Size(); i++)
|
for (int i = 0; i < Size(); i++)
|
||||||
delete (*this)[i];
|
delete (*this)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual shared_ptr<NetgenGeometry> LoadFromMeshFile (istream & ist) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// extern DLL_HEADER Array<GeometryRegister*> geometryregister;
|
// extern DLL_HEADER Array<GeometryRegister*> geometryregister;
|
||||||
|
@ -1315,6 +1315,23 @@ namespace netgen
|
|||||||
|
|
||||||
archive & *ident;
|
archive & *ident;
|
||||||
|
|
||||||
|
|
||||||
|
// archive geometry
|
||||||
|
if (archive.Output())
|
||||||
|
{
|
||||||
|
ostringstream ost;
|
||||||
|
if (geometry)
|
||||||
|
geometry -> SaveToMeshFile (ost);
|
||||||
|
archive << ost.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string str;
|
||||||
|
archive & str;
|
||||||
|
istringstream ist(str);
|
||||||
|
geometry = geometryregister.LoadFromMeshFile (ist);
|
||||||
|
}
|
||||||
|
|
||||||
if (archive.Input())
|
if (archive.Input())
|
||||||
{
|
{
|
||||||
RebuildSurfaceElementLists();
|
RebuildSurfaceElementLists();
|
||||||
|
@ -154,7 +154,8 @@ namespace netgen
|
|||||||
& edgenr & singedge_left & singedge_right
|
& edgenr & singedge_left & singedge_right
|
||||||
& si & cd2i & domin & domout & tlosurf
|
& si & cd2i & domin & domout & tlosurf
|
||||||
& surfnr1 & surfnr2
|
& surfnr1 & surfnr2
|
||||||
& bcname;
|
& bcname
|
||||||
|
& epgeominfo[0].edgenr & epgeominfo[1].edgenr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user