From 95ca834605d1369ddf7b58b97885cf6bcdfdab15 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 4 Sep 2023 13:43:47 +0200 Subject: [PATCH] move namespaces in meshing.hpp into headers --- external_dependencies/pybind11 | 2 +- libsrc/general/autodiff.hpp | 35 +-- libsrc/general/ngarray.hpp | 20 +- libsrc/general/optmem.hpp | 4 + libsrc/general/template.hpp | 4 +- libsrc/geom2d/csg2d.hpp | 2 +- libsrc/gprim/CMakeLists.txt | 2 +- libsrc/gprim/adtree.hpp | 4 + libsrc/gprim/geom2d.hpp | 8 +- libsrc/gprim/geom3d.hpp | 3 + libsrc/gprim/geomfuncs.hpp | 2 + libsrc/gprim/geomobjects.hpp | 30 ++- libsrc/gprim/geomops2.hpp | 428 ------------------------------- libsrc/gprim/geomtest3d.hpp | 2 + libsrc/gprim/transform3d.hpp | 3 + libsrc/linalg/densemat.hpp | 6 +- libsrc/linalg/linalg.hpp | 3 - libsrc/linalg/polynomial.hpp | 4 +- libsrc/linalg/vector.hpp | 7 +- libsrc/meshing/adfront2.cpp | 5 +- libsrc/meshing/adfront2.hpp | 18 +- libsrc/meshing/adfront3.cpp | 3 +- libsrc/meshing/adfront3.hpp | 10 +- libsrc/meshing/basegeom.hpp | 8 + libsrc/meshing/bisect.cpp | 4 +- libsrc/meshing/bisect.hpp | 16 +- libsrc/meshing/boundarylayer.cpp | 12 +- libsrc/meshing/boundarylayer.hpp | 9 +- libsrc/meshing/clusters.cpp | 2 +- libsrc/meshing/clusters.hpp | 12 +- libsrc/meshing/curvedelems.cpp | 3 +- libsrc/meshing/curvedelems.hpp | 18 +- libsrc/meshing/delaunay2d.cpp | 1 + libsrc/meshing/findip.hpp | 8 +- libsrc/meshing/findip2.hpp | 8 + libsrc/meshing/geomsearch.cpp | 3 +- libsrc/meshing/geomsearch.hpp | 66 +---- libsrc/meshing/global.cpp | 7 +- libsrc/meshing/global.hpp | 15 +- libsrc/meshing/hprefinement.cpp | 1 - libsrc/meshing/hprefinement.hpp | 5 + libsrc/meshing/improve2.hpp | 15 +- libsrc/meshing/improve3.hpp | 5 +- libsrc/meshing/meshclass.cpp | 7 + libsrc/meshing/meshclass.hpp | 22 +- libsrc/meshing/meshfunc.hpp | 7 +- libsrc/meshing/meshing.hpp | 15 +- libsrc/meshing/meshing2.hpp | 23 +- libsrc/meshing/meshing3.hpp | 19 +- libsrc/meshing/meshtool.hpp | 14 +- libsrc/meshing/meshtype.hpp | 7 + libsrc/meshing/msghandler.hpp | 2 + libsrc/meshing/ruler2.hpp | 3 + libsrc/meshing/ruler3.hpp | 5 +- libsrc/meshing/specials.hpp | 3 +- 55 files changed, 310 insertions(+), 640 deletions(-) delete mode 100644 libsrc/gprim/geomops2.hpp diff --git a/external_dependencies/pybind11 b/external_dependencies/pybind11 index 80dc998e..db412e6e 160000 --- a/external_dependencies/pybind11 +++ b/external_dependencies/pybind11 @@ -1 +1 @@ -Subproject commit 80dc998efced8ceb2be59756668a7e90e8bef917 +Subproject commit db412e6e8648a5687d73ef4cf28738d1e7f0e53f diff --git a/libsrc/general/autodiff.hpp b/libsrc/general/autodiff.hpp index e2ba63d0..10cf7a4f 100644 --- a/libsrc/general/autodiff.hpp +++ b/libsrc/general/autodiff.hpp @@ -9,6 +9,8 @@ // Automatic differentiation datatype +namespace netgen +{ /** Datatype for automatic differentiation. @@ -284,18 +286,6 @@ inline AutoDiff operator* (const AutoDiff & x, const AutoDiff -inline AutoDiff sqr (const AutoDiff & x) throw() -{ - AutoDiff res; - SCAL hx = x.Value(); - res.Value() = hx*hx; - hx *= 2; - for (int i = 0; i < D; i++) - res.DValue(i) = hx*x.DValue(i); - return res; -} /// Inverse of AutoDiff template @@ -329,14 +319,28 @@ inline AutoDiff operator/ (double x, const AutoDiff & y) return x * Inv(y); } +} //namespace netgen - +namespace std +{ +/// AutoDiff times AutoDiff +template +inline netgen::AutoDiff sqr (const netgen::AutoDiff & x) throw() +{ + netgen::AutoDiff res; + SCAL hx = x.Value(); + res.Value() = hx*hx; + hx *= 2; + for (int i = 0; i < D; i++) + res.DValue(i) = hx*x.DValue(i); + return res; +} template -inline AutoDiff fabs (const AutoDiff & x) +inline netgen::AutoDiff fabs (const netgen::AutoDiff & x) { double abs = fabs (x.Value()); - AutoDiff res( abs ); + netgen::AutoDiff res( abs ); if (abs != 0.0) for (int i = 0; i < D; i++) res.DValue(i) = x.DValue(i) / abs; @@ -346,6 +350,7 @@ inline AutoDiff fabs (const AutoDiff & x) return res; } +} //namespace std //@} #endif diff --git a/libsrc/general/ngarray.hpp b/libsrc/general/ngarray.hpp index 6e244ec8..e3ab1fae 100644 --- a/libsrc/general/ngarray.hpp +++ b/libsrc/general/ngarray.hpp @@ -7,12 +7,14 @@ /* Date: 01. Jun. 95 */ /**************************************************************************/ +#include +#include namespace netgen { // template class IndirectArray; - template class IndirectArray; + template class NgIndirectArray; @@ -119,9 +121,9 @@ namespace netgen } template - IndirectArray > operator[] (const NgFlatArray & ia) const + NgIndirectArray > operator[] (const NgFlatArray & ia) const { - return IndirectArray > (*this, ia); + return NgIndirectArray > (*this, ia); } @@ -206,10 +208,10 @@ namespace netgen return ( Pos(elem) >= 0 ); } - operator FlatArray () const + operator ngcore::FlatArray () const { static_assert (BASE==0); - return FlatArray(size, data); + return ngcore::FlatArray(size, data); } }; @@ -422,7 +424,7 @@ namespace netgen // Only provide this function if T is archivable template - auto DoArchive(Archive& archive) -> typename std::enable_if, void>::type + auto DoArchive(ngcore::Archive& archive) -> typename std::enable_if, void>::type { if(archive.Output()) archive << size; @@ -531,13 +533,13 @@ namespace netgen */ template - class IndirectArray + class NgIndirectArray { const TA1 & array; const TA2 & ia; public: - IndirectArray (const TA1 & aa, const TA2 & aia) + NgIndirectArray (const TA1 & aa, const TA2 & aia) : array(aa), ia(aia) { ; } int Size() const { return ia.Size(); } [[deprecated("Use *Range().begin() instead")]] @@ -553,7 +555,7 @@ namespace netgen template - inline ostream & operator<< (ostream & s, const IndirectArray & ia) + inline ostream & operator<< (ostream & s, const NgIndirectArray & ia) { for (int i = ia.Begin(); i < ia.End(); i++) s << i << ": " << ia[i] << endl; diff --git a/libsrc/general/optmem.hpp b/libsrc/general/optmem.hpp index b2be31d3..f566ca14 100644 --- a/libsrc/general/optmem.hpp +++ b/libsrc/general/optmem.hpp @@ -7,6 +7,10 @@ /* Date: 04. Apr. 97 */ /**************************************************************************/ +#include + +#include "ngarray.hpp" + namespace netgen { diff --git a/libsrc/general/template.hpp b/libsrc/general/template.hpp index 61166f54..ccb35ab7 100644 --- a/libsrc/general/template.hpp +++ b/libsrc/general/template.hpp @@ -7,9 +7,11 @@ /* Date: 01. Jun. 95 */ /**************************************************************************/ +#include + namespace netgen { - + using namespace ngcore; /* templates, global types, defines and variables */ diff --git a/libsrc/geom2d/csg2d.hpp b/libsrc/geom2d/csg2d.hpp index 737c6afb..63acefee 100644 --- a/libsrc/geom2d/csg2d.hpp +++ b/libsrc/geom2d/csg2d.hpp @@ -7,7 +7,7 @@ namespace netgen { - +using namespace std; using namespace ngcore; using netgen::Point; using netgen::Vec; diff --git a/libsrc/gprim/CMakeLists.txt b/libsrc/gprim/CMakeLists.txt index b23480a4..2cd38884 100644 --- a/libsrc/gprim/CMakeLists.txt +++ b/libsrc/gprim/CMakeLists.txt @@ -11,7 +11,7 @@ target_sources(nglib PRIVATE install(FILES adtree.hpp geom2d.hpp geom3d.hpp geomfuncs.hpp - geomobjects.hpp geomops2.hpp geomops.hpp geomtest3d.hpp gprim.hpp + geomobjects.hpp geomops.hpp geomtest3d.hpp gprim.hpp splinegeometry.hpp spline.hpp transform3d.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE}/gprim COMPONENT netgen_devel ) diff --git a/libsrc/gprim/adtree.hpp b/libsrc/gprim/adtree.hpp index 594cf76d..907a5b78 100644 --- a/libsrc/gprim/adtree.hpp +++ b/libsrc/gprim/adtree.hpp @@ -8,6 +8,10 @@ /* Redesigned by Wolfram Muehlhuber, May 1998 */ /* *************************************************************************/ +#include +#include + +#include "geomfuncs.hpp" namespace netgen { diff --git a/libsrc/gprim/geom2d.hpp b/libsrc/gprim/geom2d.hpp index 890a456b..d382676c 100644 --- a/libsrc/gprim/geom2d.hpp +++ b/libsrc/gprim/geom2d.hpp @@ -7,6 +7,12 @@ /* Date: 5. Aug. 95 */ /* *************************************************************************/ +#include + +#include +#include "geomobjects.hpp" +#include + namespace netgen { @@ -15,7 +21,7 @@ namespace netgen #define EPSGEOM 1E-5 - // extern void MyError (const char * ch); + void MyError (const char * ch); class Point2d; class Vec2d; diff --git a/libsrc/gprim/geom3d.hpp b/libsrc/gprim/geom3d.hpp index 068848d5..ca3c26f6 100644 --- a/libsrc/gprim/geom3d.hpp +++ b/libsrc/gprim/geom3d.hpp @@ -7,6 +7,9 @@ /* Date: 5. Aug. 95 */ /* *************************************************************************/ +#include +#include "geom2d.hpp" + namespace netgen { diff --git a/libsrc/gprim/geomfuncs.hpp b/libsrc/gprim/geomfuncs.hpp index 2a647b25..34301312 100644 --- a/libsrc/gprim/geomfuncs.hpp +++ b/libsrc/gprim/geomfuncs.hpp @@ -7,6 +7,8 @@ /* Date: 20. Jul. 02 */ /* *************************************************************************/ +#include "geomobjects.hpp" +#include "geomops.hpp" namespace netgen { diff --git a/libsrc/gprim/geomobjects.hpp b/libsrc/gprim/geomobjects.hpp index 32a22318..e31110fc 100644 --- a/libsrc/gprim/geomobjects.hpp +++ b/libsrc/gprim/geomobjects.hpp @@ -7,10 +7,14 @@ /* Date: 20. Jul. 02 */ /* *************************************************************************/ +#include +#include + +#include namespace netgen { - + using namespace ngcore; template class Vec; template class Point; @@ -170,6 +174,26 @@ namespace netgen Vec GetNormal () const; }; + template + inline ostream & operator<< (ostream & ost, const Vec & a) + { + ost << "("; + for (int i = 0; i < D-1; i++) + ost << a(i) << ", "; + ost << a(D-1) << ")"; + return ost; + } + + template + inline ostream & operator<< (ostream & ost, const Point & a) + { + ost << "("; + for (int i = 0; i < D-1; i++) + ost << a(i) << ", "; + ost << a(D-1) << ")"; + return ost; + } + template inline Vec operator-(const Point& p1, const Point& p2) { @@ -338,7 +362,7 @@ namespace netgen } template - void Set (const IndirectArray & points) + void Set (const NgIndirectArray & points) { // Set (points[points.Begin()]); Set (points[*points.Range().begin()]); @@ -348,7 +372,7 @@ namespace netgen } template - void Add (const IndirectArray & points) + void Add (const NgIndirectArray & points) { // for (int i = points.Begin(); i < points.End(); i++) for (int i : points.Range()) diff --git a/libsrc/gprim/geomops2.hpp b/libsrc/gprim/geomops2.hpp deleted file mode 100644 index c615da14..00000000 --- a/libsrc/gprim/geomops2.hpp +++ /dev/null @@ -1,428 +0,0 @@ -#ifndef FILE_GEOMOPS -#define FILE_GEOMOPS - -/* *************************************************************************/ -/* File: geomops.hpp */ -/* Author: Joachim Schoeberl */ -/* Date: 20. Jul. 02 */ -/* *************************************************************************/ - - -/* - -Point - Vector operations - - */ - - - - -template -class SumExpr : public VecExpr > -{ - const TA a; - const TB b; -public: - SumExpr (const TA aa, const TB ab) : a(aa), b(ab) { ; } - double operator() (int i) const { return a(i) + b(i); } -}; - -template -inline SumExpr -operator+ (const VecExpr & a, const VecExpr & b) -{ - return SumExpr (static_cast (a), static_cast (b)); -} - -/* -template -inline SumExpr&, const Vec&> -operator+ (const Vec & a, const Vec & b) -{ - return SumExpr&, const Vec&> (a, b); -} -*/ - - - - - -/* -template -inline Vec operator+ (const Vec & a, const Vec & b) -{ - Vec res; - for (int i = 0; i < D; i++) - res(i) = a(i) + b(i); - return res; -} -*/ - -template -inline Point operator+ (const Point & a, const Vec & b) -{ - Point res; - for (int i = 0; i < D; i++) - res(i) = a(i) + b(i); - return res; -} - - -template -inline Vec operator- (const Point & a, const Point & b) -{ - Vec res; - for (int i = 0; i < D; i++) - res(i) = a(i) - b(i); - return res; -} - -template -inline Point operator- (const Point & a, const Vec & b) -{ - Point res; - for (int i = 0; i < D; i++) - res(i) = a(i) - b(i); - return res; -} - -template -inline Vec operator- (const Vec & a, const Vec & b) -{ - Vec res; - for (int i = 0; i < D; i++) - res(i) = a(i) - b(i); - return res; -} - - -template -inline Vec operator* (double s, const Vec & b) -{ - Vec res; - for (int i = 0; i < D; i++) - res(i) = s * b(i); - return res; -} - - -template -inline double operator* (const Vec & a, const Vec & b) -{ - double sum = 0; - for (int i = 0; i < D; i++) - sum += a(i) * b(i); - return sum; -} - - - -template -inline Vec operator- (const Vec & b) -{ - Vec res; - for (int i = 0; i < D; i++) - res(i) = -b(i); - return res; -} - - -template -inline Point & operator+= (Point & a, const Vec & b) -{ - for (int i = 0; i < D; i++) - a(i) += b(i); - return a; -} - - -template -inline Point & operator+= (Point & a, const VecExpr & b) -{ - for (int i = 0; i < D; i++) - a(i) += b(i); - return a; -} - -template -inline Vec & operator+= (Vec & a, const Vec & b) -{ - for (int i = 0; i < D; i++) - a(i) += b(i); - return a; -} - - - - - -template -inline Point & operator-= (Point & a, const Vec & b) -{ - for (int i = 0; i < D; i++) - a(i) -= b(i); - return a; -} - -template -inline Point & operator-= (Point & a, const VecExpr & b) -{ - for (int i = 0; i < D; i++) - a(i) -= b(i); - return a; -} - - - - - -template -inline Vec & operator-= (Vec & a, const Vec & b) -{ - for (int i = 0; i < D; i++) - a(i) -= b(i); - return a; -} - - - -template -inline Vec & operator*= (Vec & a, double s) -{ - for (int i = 0; i < D; i++) - a(i) *= s; - return a; -} - - -template -inline Vec & operator/= (Vec & a, double s) -{ - for (int i = 0; i < D; i++) - a(i) /= s; - return a; -} - - - - -// Matrix - Vector operations - -/* -template -inline Vec operator* (const Mat & m, const Vec & v) -{ - Vec res; - for (int i = 0; i < H; i++) - { - res(i) = 0; - for (int j = 0; j < W; j++) - res(i) += m(i,j) * v(j); - } - return res; -} -*/ - -// thanks to VC60 partial template specialization features !!! - -inline Vec<2> operator* (const Mat<2,2> & m, const Vec<2> & v) -{ - Vec<2> res; - for (int i = 0; i < 2; i++) - { - res(i) = 0; - for (int j = 0; j < 2; j++) - res(i) += m(i,j) * v(j); - } - return res; -} - -inline Vec<2> operator* (const Mat<2,3> & m, const Vec<3> & v) -{ - Vec<2> res; - for (int i = 0; i < 2; i++) - { - res(i) = 0; - for (int j = 0; j < 3; j++) - res(i) += m(i,j) * v(j); - } - return res; -} - - -inline Vec<3> operator* (const Mat<3,2> & m, const Vec<2> & v) -{ - Vec<3> res; - for (int i = 0; i < 3; i++) - { - res(i) = 0; - for (int j = 0; j < 2; j++) - res(i) += m(i,j) * v(j); - } - return res; -} - - -inline Vec<3> operator* (const Mat<3,3> & m, const Vec<3> & v) -{ - Vec<3> res; - for (int i = 0; i < 3; i++) - { - res(i) = 0; - for (int j = 0; j < 3; j++) - res(i) += m(i,j) * v(j); - } - return res; -} - - - - - - - -/* -template -inline Mat operator* (const Mat & a, const Mat & b) -{ - Mat m; - for (int i = 0; i < H1; i++) - for (int j = 0; j < W2; j++) - { - double sum = 0; - for (int k = 0; k < W1; k++) - sum += a(i,k) * b(k, j); - m(i,j) = sum; - } - return m; -} -*/ - -inline Mat<2,2> operator* (const Mat<2,2> & a, const Mat<2,2> & b) -{ - Mat<2,2> m; - for (int i = 0; i < 2; i++) - for (int j = 0; j < 2; j++) - { - double sum = 0; - for (int k = 0; k < 2; k++) - sum += a(i,k) * b(k, j); - m(i,j) = sum; - } - return m; -} - -inline Mat<2,2> operator* (const Mat<2,3> & a, const Mat<3,2> & b) -{ - Mat<2,2> m; - for (int i = 0; i < 2; i++) - for (int j = 0; j < 2; j++) - { - double sum = 0; - for (int k = 0; k < 3; k++) - sum += a(i,k) * b(k, j); - m(i,j) = sum; - } - return m; -} - - -inline Mat<3,2> operator* (const Mat<3,2> & a, const Mat<2,2> & b) -{ - Mat<3,2> m; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 2; j++) - { - double sum = 0; - for (int k = 0; k < 2; k++) - sum += a(i,k) * b(k, j); - m(i,j) = sum; - } - return m; -} - -inline Mat<3,3> operator* (const Mat<3,3> & a, const Mat<3,3> & b) -{ - Mat<3,3> m; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - { - double sum = 0; - for (int k = 0; k < 3; k++) - sum += a(i,k) * b(k, j); - m(i,j) = sum; - } - return m; -} - - - - - - - - -template -inline Mat Trans (const Mat & m) -{ - Mat res; - for (int i = 0; i < H; i++) - for (int j = 0; j < W; j++) - res(j,i) = m(i,j); - return res; -} - - - - - - - - - - - -template -inline ostream & operator<< (ostream & ost, const Vec & a) -{ - ost << "("; - for (int i = 0; i < D-1; i++) - ost << a(i) << ", "; - ost << a(D-1) << ")"; - return ost; -} - -template -inline ostream & operator<< (ostream & ost, const Point & a) -{ - ost << "("; - for (int i = 0; i < D-1; i++) - ost << a(i) << ", "; - ost << a(D-1) << ")"; - return ost; -} - -template -inline ostream & operator<< (ostream & ost, const Box & b) -{ - ost << b.PMin() << " - " << b.PMax(); - return ost; -} - -template -inline ostream & operator<< (ostream & ost, const Mat & m) -{ - ost << "("; - for (int i = 0; i < H; i++) - { - for (int j = 0; j < W; j++) - ost << m(i,j) << " "; - ost << endl; - } - return ost; -} - - - - -#endif diff --git a/libsrc/gprim/geomtest3d.hpp b/libsrc/gprim/geomtest3d.hpp index 954d32e7..837c402b 100644 --- a/libsrc/gprim/geomtest3d.hpp +++ b/libsrc/gprim/geomtest3d.hpp @@ -7,6 +7,8 @@ /* Date: 13. Feb. 98 */ /* *************************************************************************/ +#include "geom3d.hpp" +#include "geomobjects.hpp" namespace netgen { diff --git a/libsrc/gprim/transform3d.hpp b/libsrc/gprim/transform3d.hpp index b5886d29..0e8a6610 100644 --- a/libsrc/gprim/transform3d.hpp +++ b/libsrc/gprim/transform3d.hpp @@ -11,6 +11,9 @@ Affine - Linear mapping in 3D space */ +#include "geom3d.hpp" +#include "geomfuncs.hpp" + namespace netgen { diff --git a/libsrc/linalg/densemat.hpp b/libsrc/linalg/densemat.hpp index 5b3bb6a5..73b5ee93 100644 --- a/libsrc/linalg/densemat.hpp +++ b/libsrc/linalg/densemat.hpp @@ -11,7 +11,11 @@ Data type dense matrix */ +#include +#include "vector.hpp" +namespace netgen +{ class DenseMatrix { protected: @@ -406,5 +410,5 @@ extern ostream & operator<< (ostream & ost, const MatrixFixWidth & m) extern DLL_HEADER void CalcAtA (const DenseMatrix & a, DenseMatrix & m2); extern DLL_HEADER void CalcInverse (const DenseMatrix & m1, DenseMatrix & m2); - +} // namespace netgen #endif diff --git a/libsrc/linalg/linalg.hpp b/libsrc/linalg/linalg.hpp index 95d0c823..10bc6c50 100644 --- a/libsrc/linalg/linalg.hpp +++ b/libsrc/linalg/linalg.hpp @@ -21,12 +21,9 @@ #include "../include/myadt.hpp" -namespace netgen -{ #include "vector.hpp" #include "densemat.hpp" #include "polynomial.hpp" -} #endif diff --git a/libsrc/linalg/polynomial.hpp b/libsrc/linalg/polynomial.hpp index 3108d4dd..a97db58e 100644 --- a/libsrc/linalg/polynomial.hpp +++ b/libsrc/linalg/polynomial.hpp @@ -7,6 +7,8 @@ /* Date: 25. Nov. 99 */ /* *************************************************************************/ +namespace netgen +{ class QuadraticPolynomial1V { @@ -41,5 +43,5 @@ public: double MaxUnitSquare (); double MaxUnitTriangle (); }; - +} // namespace netgen #endif diff --git a/libsrc/linalg/vector.hpp b/libsrc/linalg/vector.hpp index 97ad05ed..cee6bd93 100644 --- a/libsrc/linalg/vector.hpp +++ b/libsrc/linalg/vector.hpp @@ -7,8 +7,11 @@ /* Date: 01. Oct. 94 */ /* *************************************************************************/ +#include - +namespace netgen +{ + using namespace ngcore; template class TFlatVector @@ -209,7 +212,7 @@ inline ostream & operator<< (ostream & ost, const FlatVector & v) return ost; } - +} //namespace netgen #endif diff --git a/libsrc/meshing/adfront2.cpp b/libsrc/meshing/adfront2.cpp index ab27334b..390e0879 100644 --- a/libsrc/meshing/adfront2.cpp +++ b/libsrc/meshing/adfront2.cpp @@ -3,8 +3,9 @@ */ #include -#include "meshing.hpp" - +#include +#include +#include "adfront2.hpp" namespace netgen { diff --git a/libsrc/meshing/adfront2.hpp b/libsrc/meshing/adfront2.hpp index 95914535..081aaa25 100644 --- a/libsrc/meshing/adfront2.hpp +++ b/libsrc/meshing/adfront2.hpp @@ -1,5 +1,5 @@ -#ifndef FILE_ADFRONT2 -#define FILE_ADFRONT2 +#ifndef NETGEN_ADFRONT2_HPP +#define NETGEN_ADFRONT2_HPP /**************************************************************************/ /* File: adfront2.hpp */ @@ -14,6 +14,12 @@ */ +#include +#include +#include "meshtype.hpp" + +namespace netgen +{ /// class FrontPoint2 { @@ -275,9 +281,5 @@ public: void PrintOpenSegments (ostream & ost) const; }; - - -#endif - - - +} // namespace netgen +#endif // NETGEN_ADFRONT2_HPP diff --git a/libsrc/meshing/adfront3.cpp b/libsrc/meshing/adfront3.cpp index c0776ebf..df77fdde 100644 --- a/libsrc/meshing/adfront3.cpp +++ b/libsrc/meshing/adfront3.cpp @@ -1,6 +1,7 @@ #include -#include "meshing.hpp" +#include +#include "adfront3.hpp" /* ********************** FrontPoint ********************** */ diff --git a/libsrc/meshing/adfront3.hpp b/libsrc/meshing/adfront3.hpp index 5960ca5c..859a8b42 100644 --- a/libsrc/meshing/adfront3.hpp +++ b/libsrc/meshing/adfront3.hpp @@ -11,7 +11,13 @@ Advancing front class for volume meshing */ +#include +#include +#include "meshtype.hpp" +#include "geomsearch.hpp" +namespace netgen +{ /// Point in advancing front class FrontPoint3 @@ -315,7 +321,5 @@ private: void RebuildInternalTables(); }; - - - +} // namespace netgen #endif diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index bb9a508c..7dbc1e17 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -7,10 +7,18 @@ /* Date: 23. Aug. 09 */ /**************************************************************************/ +#include +#include + +#include "meshtype.hpp" +#include "meshclass.hpp" + struct Tcl_Interp; namespace netgen { + class Refinement; + struct ShapeProperties { optional name; diff --git a/libsrc/meshing/bisect.cpp b/libsrc/meshing/bisect.cpp index fcabc286..5b8abfde 100644 --- a/libsrc/meshing/bisect.cpp +++ b/libsrc/meshing/bisect.cpp @@ -1,5 +1,7 @@ #include -#include "meshing.hpp" +#include +#include "bisect.hpp" +#include "validate.hpp" #define noDEBUG diff --git a/libsrc/meshing/bisect.hpp b/libsrc/meshing/bisect.hpp index eef60d73..2e10a87b 100644 --- a/libsrc/meshing/bisect.hpp +++ b/libsrc/meshing/bisect.hpp @@ -1,5 +1,13 @@ -#ifndef BISECT -#define BISECT +#ifndef NETGEN_BISECT_HPP +#define NETGEN_BISECT_HPP + +#include +#include +#include "basegeom.hpp" +#include "meshclass.hpp" + +namespace netgen +{ class BisectionOptions { @@ -59,4 +67,6 @@ public: virtual void LocalizeEdgePoints(Mesh & /* mesh */) const {;} }; -#endif +} // namespace netgen + +#endif // NETGEN_BISECT_HPP diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 6c078d27..3cc15ae2 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -1,10 +1,14 @@ -#include -#include "meshing.hpp" -#include "debugging.hpp" -#include "global.hpp" #include #include +#include + +#include "global.hpp" +#include "debugging.hpp" + +#include "boundarylayer.hpp" +#include "meshfunc.hpp" + namespace netgen { diff --git a/libsrc/meshing/boundarylayer.hpp b/libsrc/meshing/boundarylayer.hpp index 3b83dc05..b3c18d3a 100644 --- a/libsrc/meshing/boundarylayer.hpp +++ b/libsrc/meshing/boundarylayer.hpp @@ -1,6 +1,8 @@ -#ifndef FILE_BOUNDARYLAYER -#define FILE_BOUNDARYLAYER +#ifndef NETGEN_BOUNDARYLAYER_HPP +#define NETGEN_BOUNDARYLAYER_HPP +namespace netgen +{ /// DLL_HEADER extern void InsertVirtualBoundaryLayer (Mesh & mesh); @@ -88,4 +90,5 @@ class BoundaryLayerTool Vec<3> getEdgeTangent(PointIndex pi, int edgenr); }; -#endif +} // namespace netgen +#endif // NETGEN_BOUNDARYLAYER_HPP diff --git a/libsrc/meshing/clusters.cpp b/libsrc/meshing/clusters.cpp index 3bb98f9e..b64fbc3f 100644 --- a/libsrc/meshing/clusters.cpp +++ b/libsrc/meshing/clusters.cpp @@ -1,6 +1,6 @@ #include -#include "meshing.hpp" +#include "clusters.hpp" namespace netgen { diff --git a/libsrc/meshing/clusters.hpp b/libsrc/meshing/clusters.hpp index 21854f39..e9cc901c 100644 --- a/libsrc/meshing/clusters.hpp +++ b/libsrc/meshing/clusters.hpp @@ -1,5 +1,5 @@ -#ifndef CLUSTERS -#define CLUSTERS +#ifndef NETGEN_CLUSTERS_HPP +#define NETGEN_CLUSTERS_HPP /**************************************************************************/ /* File: clusers.hh */ @@ -13,6 +13,10 @@ nodes, edges, faces, elements */ +#include "meshclass.hpp" + +namespace netgen +{ class AnisotropicClusters { @@ -38,5 +42,5 @@ public: int GetElementRepresentant (int enr) const { return cluster_reps.Get(nv+ned+nfa+enr); } }; - -#endif +} // namespace netgen +#endif // NETGEN_CLUSTERS_HPP diff --git a/libsrc/meshing/curvedelems.cpp b/libsrc/meshing/curvedelems.cpp index af5ed1c0..612862e0 100644 --- a/libsrc/meshing/curvedelems.cpp +++ b/libsrc/meshing/curvedelems.cpp @@ -7,9 +7,8 @@ namespace netgen { - + using namespace std; // bool rational = true; - static void ComputeGaussRule (int n, NgArray & xi, NgArray & wi) { xi.SetSize (n); diff --git a/libsrc/meshing/curvedelems.hpp b/libsrc/meshing/curvedelems.hpp index 59fbb86d..423732bd 100644 --- a/libsrc/meshing/curvedelems.hpp +++ b/libsrc/meshing/curvedelems.hpp @@ -1,5 +1,5 @@ -#ifndef CURVEDELEMS -#define CURVEDELEMS +#ifndef NETGEN_CURVEDELEMS_HPP +#define NETGEN_CURVEDELEMS_HPP /**************************************************************************/ /* File: curvedelems.hpp */ @@ -8,11 +8,16 @@ /* Date: 27. Sep. 02, Feb 2006 */ /**************************************************************************/ +#include +#include +#include +#include "meshtype.hpp" - +namespace netgen +{ class Refinement; - +class Mesh; class CurvedElements { @@ -259,6 +264,5 @@ private: bool EvaluateMapping (SurfaceElementInfo & info, const Point<2,T> xi, Point & x, Mat & jac) const; }; - - -#endif +} //namespace netgen +#endif // NETGEN_CURVEDELEMS_HPP diff --git a/libsrc/meshing/delaunay2d.cpp b/libsrc/meshing/delaunay2d.cpp index db6bcc71..7a7b2b2d 100644 --- a/libsrc/meshing/delaunay2d.cpp +++ b/libsrc/meshing/delaunay2d.cpp @@ -6,6 +6,7 @@ namespace netgen { + using namespace std; void DelaunayTrig::CalcCenter (FlatArray, PointIndex> points) { Point<2> p1 = points[pnums[0]]; diff --git a/libsrc/meshing/findip.hpp b/libsrc/meshing/findip.hpp index 71de05f9..41390380 100644 --- a/libsrc/meshing/findip.hpp +++ b/libsrc/meshing/findip.hpp @@ -1,6 +1,10 @@ +#ifndef NETGEN_FINDIP_HPP +#define NETGEN_FINDIP_HPP + // find inner point - +namespace netgen +{ inline void Minimize (const NgArray & a, const NgArray & c, @@ -188,5 +192,7 @@ inline int FindInnerPoint (POINTArray & points, return (f < -1e-5 * hmax); } +} // namespace netgen +#endif // FILE_FINDINNERPOINT_HPP diff --git a/libsrc/meshing/findip2.hpp b/libsrc/meshing/findip2.hpp index 62009b25..e27f82e2 100644 --- a/libsrc/meshing/findip2.hpp +++ b/libsrc/meshing/findip2.hpp @@ -1,5 +1,11 @@ +#ifndef NETGEN_FINDIP2_HPP +#define NETGEN_FINDIP2_HPP + // find inner point +namespace netgen +{ + template inline int FindInnerPoint2 (POINTArray & points, FACEArray & faces, @@ -93,3 +99,5 @@ inline int FindInnerPoint2 (POINTArray & points, return (fmin < -1e-3 * hmax); } +} // namespace netgen +#endif // NETGEN_FINDIP2_HPP diff --git a/libsrc/meshing/geomsearch.cpp b/libsrc/meshing/geomsearch.cpp index bfeeecc9..88e9ebe9 100644 --- a/libsrc/meshing/geomsearch.cpp +++ b/libsrc/meshing/geomsearch.cpp @@ -1,5 +1,6 @@ #include -#include "meshing.hpp" +#include "geomsearch.hpp" +#include "adfront3.hpp" namespace netgen diff --git a/libsrc/meshing/geomsearch.hpp b/libsrc/meshing/geomsearch.hpp index 5adba567..fc817b5b 100644 --- a/libsrc/meshing/geomsearch.hpp +++ b/libsrc/meshing/geomsearch.hpp @@ -1,5 +1,5 @@ -#ifndef FILE_GEOMSEARCH -#define FILE_GEOMSEARCH +#ifndef NETGEN_GEOMSEARCH_HPP +#define NETGEN_GEOMSEARCH_HPP /**************************************************************************/ /* File: geomsearch.hh */ @@ -7,6 +7,11 @@ /* Date: 19. Nov. 97 */ /**************************************************************************/ +#include "meshtype.hpp" + +namespace netgen +{ + class FrontPoint3; class FrontFace; class MiniElement2d; @@ -60,58 +65,5 @@ private: int reset; int hashcount; }; - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +} // namespace netgen +#endif // NETGEN_GEOMSEARCH_HPP diff --git a/libsrc/meshing/global.cpp b/libsrc/meshing/global.cpp index 9bbce766..bdde3046 100644 --- a/libsrc/meshing/global.cpp +++ b/libsrc/meshing/global.cpp @@ -1,11 +1,12 @@ #include -#include "meshing.hpp" +#include "global.hpp" #include - +#include "msghandler.hpp" +#include "meshtype.hpp" namespace netgen { - + class NetgenGeometry; class TraceGlobal { string name; diff --git a/libsrc/meshing/global.hpp b/libsrc/meshing/global.hpp index e19c094b..1ab2ad32 100644 --- a/libsrc/meshing/global.hpp +++ b/libsrc/meshing/global.hpp @@ -1,5 +1,5 @@ -#ifndef FILE_GLOBAL -#define FILE_GLOBAL +#ifndef NETGEN_GLOBAL_HPP +#define NETGEN_GLOBAL_HPP /**************************************************************************/ @@ -12,9 +12,11 @@ global functions and variables */ +#include + namespace netgen { - + using namespace ngcore; /// DLL_HEADER extern double GetTime (); DLL_HEADER extern void ResetTime (); @@ -47,6 +49,9 @@ namespace netgen DLL_HEADER extern volatile multithreadt multithread; + class DebugParameters; + class Mesh; + DLL_HEADER extern string ngdir; DLL_HEADER extern DebugParameters debugparam; DLL_HEADER extern bool verbose; @@ -61,6 +66,6 @@ namespace netgen // global communicator for netgen (dummy if no MPI) // extern DLL_HEADER NgMPI_Comm ng_comm; -} +} // namespace netgen -#endif +#endif // NETGEN_GLOBAL_HPP diff --git a/libsrc/meshing/hprefinement.cpp b/libsrc/meshing/hprefinement.cpp index ecb6505b..a558167b 100644 --- a/libsrc/meshing/hprefinement.cpp +++ b/libsrc/meshing/hprefinement.cpp @@ -1,6 +1,5 @@ #include #include "meshing.hpp" -#include "hprefinement.hpp" namespace netgen { diff --git a/libsrc/meshing/hprefinement.hpp b/libsrc/meshing/hprefinement.hpp index 5d1e498a..4b3f8395 100644 --- a/libsrc/meshing/hprefinement.hpp +++ b/libsrc/meshing/hprefinement.hpp @@ -11,7 +11,11 @@ HP Refinement */ +#include "bisect.hpp" +#include "meshtype.hpp" +namespace netgen +{ enum HPREF_ELEMENT_TYPE { @@ -324,5 +328,6 @@ inline void HPRefinement (Mesh & mesh, Refinement * ref, int levels, HPRefinement (mesh, ref, SPLIT_HP, levels, fac1, setorders, ref_level); } +} // namespace netgen #endif diff --git a/libsrc/meshing/improve2.hpp b/libsrc/meshing/improve2.hpp index 444062a2..539b0055 100644 --- a/libsrc/meshing/improve2.hpp +++ b/libsrc/meshing/improve2.hpp @@ -1,5 +1,10 @@ -#ifndef FILE_IMPROVE2 -#define FILE_IMPROVE2 +#ifndef NETGEN_IMPROVE2_HPP +#define NETGEN_IMPROVE2_HPP + +#include "meshtype.hpp" + +namespace netgen +{ inline void AppendEdges( const Element2d & elem, PointIndex pi, Array> & edges ) { @@ -169,7 +174,5 @@ extern double CalcTriangleBadness (const Point<3> & p1, const Vec<3> & n, double metricweight, double h); - -#endif - - +} // namespace netgen +#endif // NETGEN_IMPROVE2_HPP diff --git a/libsrc/meshing/improve3.hpp b/libsrc/meshing/improve3.hpp index 605c523c..43820406 100644 --- a/libsrc/meshing/improve3.hpp +++ b/libsrc/meshing/improve3.hpp @@ -1,6 +1,8 @@ #ifndef FILE_IMPROVE3 #define FILE_IMPROVE3 +namespace netgen +{ extern double CalcTotalBad (const Mesh::T_POINTS & points, const Array & elements, @@ -136,6 +138,5 @@ public: inline void UnSetNV(void) {onplane = false;} }; - - +} // namespace netgen #endif diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 87d25274..d69c74ea 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5,6 +5,7 @@ #include "../general/gzstream.h" #include +#include "basegeom.hpp" namespace netgen { @@ -292,6 +293,12 @@ namespace netgen // #endif } + shared_ptr Mesh :: GetGeometry() const + { + static auto global_geometry = make_shared(); + return geometry ? geometry : global_geometry; + } + void Mesh :: SetCommunicator(NgMPI_Comm acomm) { this->comm = acomm; diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 22ac8960..d6d62ba5 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -1,5 +1,5 @@ -#ifndef MESHCLASS -#define MESHCLASS +#ifndef NETGEN_MESHCLASS_HPP +#define NETGEN_MESHCLASS_HPP /**************************************************************************/ /* File: meshclass.hpp */ @@ -13,8 +13,16 @@ #include +#include +#include + +#include "meshtype.hpp" +#include "localh.hpp" +#include "topology.hpp" + namespace netgen { + class NetgenGeometry; using namespace std; static constexpr int MPI_TAG_MESH = 210; @@ -874,11 +882,7 @@ namespace netgen NgMutex & MajorMutex () { return majormutex; } - shared_ptr GetGeometry() const - { - static auto global_geometry = make_shared(); - return geometry ? geometry : global_geometry; - } + DLL_HEADER shared_ptr GetGeometry() const; void SetGeometry (shared_ptr geom) { geometry = geom; @@ -993,6 +997,4 @@ namespace netgen } -#endif - - +#endif // NETGEN_MESHCLASS_HPP diff --git a/libsrc/meshing/meshfunc.hpp b/libsrc/meshing/meshfunc.hpp index fdbdef4e..81157eee 100644 --- a/libsrc/meshing/meshfunc.hpp +++ b/libsrc/meshing/meshfunc.hpp @@ -7,7 +7,12 @@ /* Date: 26. Jan. 98 */ /**************************************************************************/ +#include +#include "meshing3.hpp" +#include "meshtype.hpp" +namespace netgen +{ /* Functions for mesh-generations strategies */ @@ -36,6 +41,6 @@ enum MESHING_STEP { MESHCONST_MESHVOLUME = 5, MESHCONST_OPTVOLUME = 6 }; - +} // namespace netgen #endif diff --git a/libsrc/meshing/meshing.hpp b/libsrc/meshing/meshing.hpp index 52a0dfc2..48dc76f2 100644 --- a/libsrc/meshing/meshing.hpp +++ b/libsrc/meshing/meshing.hpp @@ -15,6 +15,7 @@ namespace netgen // extern int printmessage_importance; // class CSGeometry; + using namespace std; class NetgenGeometry; } @@ -26,12 +27,12 @@ namespace netgen #include "meshclass.hpp" #include "global.hpp" - -namespace netgen -{ #include "meshtool.hpp" + #include "ruler2.hpp" #include "adfront2.hpp" + + #include "meshing2.hpp" #include "improve2.hpp" @@ -40,8 +41,6 @@ namespace netgen #include "adfront3.hpp" #include "ruler3.hpp" -#define _INCLUDE_MORE - #include "findip.hpp" #include "findip2.hpp" @@ -50,21 +49,17 @@ namespace netgen #include "curvedelems.hpp" #include "clusters.hpp" - #include "meshfunc.hpp" #include "bisect.hpp" #include "hprefinement.hpp" + #include "boundarylayer.hpp" #include "specials.hpp" - -} - #include "validate.hpp" #include "basegeom.hpp" #include "surfacegeom.hpp" #include "paralleltop.hpp" - #endif diff --git a/libsrc/meshing/meshing2.hpp b/libsrc/meshing/meshing2.hpp index 2af29296..e35d5fab 100644 --- a/libsrc/meshing/meshing2.hpp +++ b/libsrc/meshing/meshing2.hpp @@ -1,5 +1,5 @@ -#ifndef FILE_MESHING2 -#define FILE_MESHING2 +#ifndef NETGEN_MESHING2_HPP +#define NETGEN_MESHING2_HPP /**************************************************************************/ /* File: meshing2.hpp */ @@ -7,6 +7,8 @@ /* Date: 01. Okt. 95 */ /**************************************************************************/ +namespace netgen +{ enum MESHING2_RESULT @@ -151,19 +153,6 @@ protected: }; +} // namespace netgen - - - - - - - -#endif - - - - - - - +#endif // NETGEN_MESHING2_HPP diff --git a/libsrc/meshing/meshing3.hpp b/libsrc/meshing/meshing3.hpp index 65b153b9..cc28a276 100644 --- a/libsrc/meshing/meshing3.hpp +++ b/libsrc/meshing/meshing3.hpp @@ -1,8 +1,11 @@ #ifndef FILE_MESHING3 #define FILE_MESHING3 +#include "adfront3.hpp" +#include "ruler3.hpp" - +namespace netgen +{ enum MESHING3_RESULT { @@ -114,18 +117,6 @@ extern int FindInnerPoint (POINTArray & grouppoints, */ - - - +} // namespace netgen #endif - - - - - - - - - - diff --git a/libsrc/meshing/meshtool.hpp b/libsrc/meshing/meshtool.hpp index 4bfac0e3..135d36ec 100644 --- a/libsrc/meshing/meshtool.hpp +++ b/libsrc/meshing/meshtool.hpp @@ -1,7 +1,13 @@ -#ifndef FILE_MESHTOOL -#define FILE_MESHTOOL +#ifndef NETGEN_MESHTOOL_HPP +#define NETGEN_MESHTOOL_HPP +// #include "../general/ngarray.hpp" +// #include "../gprim/geom3d.hpp" +// #include "../gprim/geomobjects.hpp" +// #include "meshtype.hpp" +// #include "meshclass.hpp" +namespace netgen { /// extern void MeshQuality2d (const Mesh & mesh); @@ -78,4 +84,6 @@ extern int CheckSurfaceMesh2 (const Mesh & mesh); extern int CheckMesh3D (const Mesh & mesh); /// extern void RemoveProblem (Mesh & mesh, int domainnr); -#endif + +} // namespace netgen +#endif // NETGEN_MESHTOOL_HPP diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 5c174b30..5945827d 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -8,6 +8,13 @@ /* Date: 01. Okt. 95 */ /**************************************************************************/ +#include +#include +#include +#include + +#include "msghandler.hpp" + namespace netgen { diff --git a/libsrc/meshing/msghandler.hpp b/libsrc/meshing/msghandler.hpp index bab57174..04f0eda9 100644 --- a/libsrc/meshing/msghandler.hpp +++ b/libsrc/meshing/msghandler.hpp @@ -7,6 +7,8 @@ /* Date: 20. Nov. 99 */ /**************************************************************************/ +#include + namespace netgen { diff --git a/libsrc/meshing/ruler2.hpp b/libsrc/meshing/ruler2.hpp index 3d9ca6af..8e3b3c41 100644 --- a/libsrc/meshing/ruler2.hpp +++ b/libsrc/meshing/ruler2.hpp @@ -1,6 +1,8 @@ #ifndef FILE_NETRULE #define FILE_NETRULE +namespace netgen +{ /// class netrule { @@ -165,5 +167,6 @@ public: /** Draws 2D rules. Visual testing of 2D meshing rules */ extern void DrawRules (); +} // namespace netgen #endif diff --git a/libsrc/meshing/ruler3.hpp b/libsrc/meshing/ruler3.hpp index 91ee4653..03a3ad82 100644 --- a/libsrc/meshing/ruler3.hpp +++ b/libsrc/meshing/ruler3.hpp @@ -1,6 +1,8 @@ #ifndef FILE_RULER3 #define FILE_RULER3 +namespace netgen +{ /** 3D element generation rule. @@ -204,7 +206,6 @@ public: // friend void Plot3DRule (const ROT3D & r, char key); }; - - +} // namespace netgen #endif diff --git a/libsrc/meshing/specials.hpp b/libsrc/meshing/specials.hpp index fd10634d..feed8146 100644 --- a/libsrc/meshing/specials.hpp +++ b/libsrc/meshing/specials.hpp @@ -7,10 +7,11 @@ */ - +namespace netgen { /// DLL_HEADER extern void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh); DLL_HEADER extern void HelmholtzMesh (Mesh & mesh); +} // namespace netgen #endif