netgen/libsrc/meshing/basegeom.hpp

131 lines
4.4 KiB
C++
Raw Normal View History

2009-08-24 06:03:40 +06:00
#ifndef FILE_BASEGEOM
#define FILE_BASEGEOM
/**************************************************************************/
/* File: basegeom.hpp */
/* Author: Joachim Schoeberl */
/* Date: 23. Aug. 09 */
/**************************************************************************/
2011-03-03 01:50:39 +05:00
struct Tcl_Interp;
2011-01-11 01:18:01 +05:00
namespace netgen
{
2009-08-24 06:03:40 +06:00
class DLL_HEADER NetgenGeometry
2011-03-03 01:50:39 +05:00
{
2019-10-03 16:52:59 +05:00
unique_ptr<Refinement> ref;
2011-03-03 01:50:39 +05:00
public:
2019-10-03 16:52:59 +05:00
NetgenGeometry()
{
ref = make_unique<Refinement>(*this);
}
2011-03-03 01:50:39 +05:00
virtual ~NetgenGeometry () { ; }
2009-08-25 20:00:20 +06:00
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
2009-08-25 20:00:20 +06:00
2019-10-03 16:52:59 +05:00
virtual const Refinement & GetRefinement () const
{
return *ref;
}
2011-01-11 01:18:01 +05:00
2019-10-02 20:20:13 +05:00
virtual void DoArchive(Archive&)
2018-12-14 16:01:58 +05:00
{ throw NgException("DoArchive not implemented for " + Demangle(typeid(*this).name())); }
2019-10-02 20:20:13 +05:00
virtual Mesh::GEOM_TYPE GetGeomType() const { return Mesh::NO_GEOM; }
virtual void Analyse(Mesh& mesh,
const MeshingParameters& mparam) {}
virtual void FindEdges(Mesh& mesh, const MeshingParameters& mparam) {}
virtual void MeshSurface(Mesh& mesh, const MeshingParameters& mparam) {}
virtual void OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam);
2019-10-02 20:20:13 +05:00
virtual void FinalizeMesh(Mesh& mesh) const {}
virtual void ProjectPoint (int surfind, Point<3> & p) const
{ }
virtual void ProjectPointEdge (int surfind, int surfind2, Point<3> & p) const { }
virtual void ProjectPointEdge (int surfind, int surfind2, Point<3> & p, EdgePointGeomInfo& gi) const
{ ProjectPointEdge(surfind, surfind2, p); }
virtual bool CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point<3> & p3) const {return false;}
virtual bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const
{
ProjectPoint(surfind, p);
return CalcPointGeomInfo(surfind, gi, p);
}
virtual Vec<3> GetNormal(int surfind, const Point<3> & p) const
{ return {0.,0.,1.}; }
virtual Vec<3> GetNormal(int surfind, const Point<3> & p, const PointGeomInfo & gi) const
{ return GetNormal(surfind, p); }
[[deprecated]]
void GetNormal(int surfind, const Point<3> & p, Vec<3> & n) const
{
n = GetNormal(surfind, p);
}
virtual void PointBetween (const Point<3> & p1,
const Point<3> & p2, double secpoint,
int surfi,
const PointGeomInfo & gi1,
const PointGeomInfo & gi2,
Point<3> & newp,
PointGeomInfo & newgi) const
{
newp = p1 + secpoint * (p2-p1);
}
virtual void PointBetweenEdge(const Point<3> & p1,
const Point<3> & p2, double secpoint,
int surfi1, int surfi2,
const EdgePointGeomInfo & ap1,
const EdgePointGeomInfo & ap2,
Point<3> & newp,
EdgePointGeomInfo & newgi) const
{
newp = p1+secpoint*(p2-p1);
}
virtual Vec<3> GetTangent(const Point<3> & p, int surfi1,
int surfi2,
const EdgePointGeomInfo & egi) const
{ throw Exception("Call GetTangent of " + Demangle(typeid(*this).name())); }
2011-03-03 01:50:39 +05:00
virtual void Save (string filename) const;
2011-08-29 16:09:11 +06:00
virtual void SaveToMeshFile (ostream & /* ost */) const { ; }
2011-03-03 01:50:39 +05:00
};
2009-08-24 06:03:40 +06:00
2010-03-23 17:52:07 +05:00
class DLL_HEADER GeometryRegister
2011-03-03 01:50:39 +05:00
{
public:
virtual ~GeometryRegister();
virtual NetgenGeometry * Load (string filename) const = 0;
2011-08-29 16:09:11 +06:00
virtual NetgenGeometry * LoadFromMeshFile (istream & /* ist */) const { return NULL; }
virtual class VisualScene * GetVisualScene (const NetgenGeometry * /* geom */) const
2011-03-03 01:50:39 +05:00
{ return NULL; }
2011-08-29 16:09:11 +06:00
virtual void SetParameters (Tcl_Interp * /* interp */) { ; }
2011-03-03 01:50:39 +05:00
};
2019-07-09 13:39:16 +05:00
class DLL_HEADER GeometryRegisterArray : public NgArray<GeometryRegister*>
2013-02-06 18:55:20 +06:00
{
public:
virtual ~GeometryRegisterArray()
{
for (int i = 0; i < Size(); i++)
delete (*this)[i];
}
virtual shared_ptr<NetgenGeometry> LoadFromMeshFile (istream & ist) const;
2013-02-06 18:55:20 +06:00
};
2019-07-09 13:39:16 +05:00
// extern DLL_HEADER NgArray<GeometryRegister*> geometryregister;
2013-02-06 18:55:20 +06:00
extern DLL_HEADER GeometryRegisterArray geometryregister;
2011-01-11 01:18:01 +05:00
}
2010-03-23 17:52:07 +05:00
2009-08-24 06:03:40 +06:00
#endif