Merge branch 'cleanup_netgen' into 'master'

move namespaces in meshing.hpp into headers

See merge request ngsolve/netgen!602
This commit is contained in:
Lackner, Christopher 2023-09-05 17:56:55 +02:00
commit 24d79dbfdd
58 changed files with 337 additions and 666 deletions

View File

@ -63,11 +63,11 @@ namespace ngcore {
return typeid(T) == ti ? nT
: Archive::Caster<T, Bases>::tryUpcast(ti, nT);
};
info.upcaster = [/*this*/](const std::type_info& ti, void* p) -> void*
info.upcaster = [](const std::type_info& ti, void* p) -> void*
{ return typeid(T) == ti ? p : Archive::Caster<T, Bases>::tryUpcast(ti, static_cast<T*>(p)); };
info.downcaster = [/*this*/](const std::type_info& ti, void* p) -> void*
info.downcaster = [](const std::type_info& ti, void* p) -> void*
{ return typeid(T) == ti ? p : Archive::Caster<T, Bases>::tryDowncast(ti, p); };
info.cargs_archiver = [this](Archive &ar, void* p) {
info.cargs_archiver = [](Archive &ar, void* p) {
if constexpr(detail::has_GetCArgs_v<T>)
ar << static_cast<T*>(p)->GetCArgs();
};

View File

@ -9,6 +9,8 @@
// Automatic differentiation datatype
namespace netgen
{
/**
Datatype for automatic differentiation.
@ -284,18 +286,6 @@ inline AutoDiff<D,SCAL> operator* (const AutoDiff<D,SCAL> & x, const AutoDiff<D,
return res;
}
/// AutoDiff times AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> sqr (const AutoDiff<D,SCAL> & x) throw()
{
AutoDiff<D,SCAL> 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<int D, typename SCAL>
@ -329,14 +319,31 @@ inline AutoDiff<D,SCAL> operator/ (double x, const AutoDiff<D,SCAL> & y)
return x * Inv(y);
}
} // namespace netgen
namespace ngcore
{
/// AutoDiff times AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> fabs (const AutoDiff<D,SCAL> & x)
inline netgen::AutoDiff<D,SCAL> sqr (const netgen::AutoDiff<D,SCAL> & x) throw()
{
netgen::AutoDiff<D,SCAL> 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;
}
} // namespace ngcore
namespace std
{
template<int D, typename SCAL>
inline netgen::AutoDiff<D,SCAL> fabs (const netgen::AutoDiff<D,SCAL> & x)
{
double abs = fabs (x.Value());
AutoDiff<D,SCAL> res( abs );
netgen::AutoDiff<D,SCAL> res( abs );
if (abs != 0.0)
for (int i = 0; i < D; i++)
res.DValue(i) = x.DValue(i) / abs;
@ -345,7 +352,5 @@ inline AutoDiff<D,SCAL> fabs (const AutoDiff<D,SCAL> & x)
res.DValue(i) = 0.0;
return res;
}
//@}
} // namespace std
#endif

View File

@ -7,6 +7,8 @@
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include "table.hpp"
namespace netgen
{
@ -1410,7 +1412,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
The array should be allocated with the double size of the expected number of entries.
*/
template <class T_HASH, class T>
class ClosedHashTable
class NgClosedHashTable
{
protected:
///
@ -1423,16 +1425,16 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
NgArray<T> cont;
public:
///
ClosedHashTable (size_t asize = 128)
NgClosedHashTable (size_t asize = 128)
: size(asize), used(0), hash(asize), cont(asize)
{
for (auto & v : hash)
SetInvalid(v);
}
ClosedHashTable (ClosedHashTable && ht2) = default;
NgClosedHashTable (NgClosedHashTable && ht2) = default;
ClosedHashTable (NgFlatArray<T_HASH> _hash, NgFlatArray<T> _cont)
NgClosedHashTable (NgFlatArray<T_HASH> _hash, NgFlatArray<T> _cont)
: size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
{
for (auto & v : hash)
@ -1440,7 +1442,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
}
ClosedHashTable & operator= (ClosedHashTable && ht2) = default;
NgClosedHashTable & operator= (NgClosedHashTable && ht2) = default;
///
size_t Size() const
@ -1474,7 +1476,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
void DoubleSize()
{
ClosedHashTable tmp(2*Size());
NgClosedHashTable tmp(2*Size());
for (auto both : *this)
tmp[both.first] = both.second;
*this = std::move(tmp);
@ -1609,10 +1611,10 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
class Iterator
{
const ClosedHashTable & tab;
const NgClosedHashTable & tab;
size_t nr;
public:
Iterator (const ClosedHashTable & _tab, size_t _nr)
Iterator (const NgClosedHashTable & _tab, size_t _nr)
: tab(_tab), nr(_nr)
{
while (nr < tab.Size() && !tab.UsedPos(nr)) nr++;
@ -1639,7 +1641,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
template <class T_HASH, class T>
ostream & operator<< (ostream & ost,
const ClosedHashTable<T_HASH,T> & tab)
const NgClosedHashTable<T_HASH,T> & tab)
{
for (size_t i = 0; i < tab.Size(); i++)
if (tab.UsedPos(i))

View File

@ -7,12 +7,13 @@
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include <core/array.hpp>
namespace netgen
{
// template <class T, int B1, int B2> class IndirectArray;
template <class TA1, class TA2> class IndirectArray;
template <class TA1, class TA2> class NgIndirectArray;
@ -119,9 +120,9 @@ namespace netgen
}
template <typename T2, int B2>
IndirectArray<NgFlatArray, NgFlatArray<T2,B2> > operator[] (const NgFlatArray<T2,B2> & ia) const
NgIndirectArray<NgFlatArray, NgFlatArray<T2,B2> > operator[] (const NgFlatArray<T2,B2> & ia) const
{
return IndirectArray<NgFlatArray, NgFlatArray<T2,B2> > (*this, ia);
return NgIndirectArray<NgFlatArray, NgFlatArray<T2,B2> > (*this, ia);
}
@ -206,10 +207,10 @@ namespace netgen
return ( Pos(elem) >= 0 );
}
operator FlatArray<T> () const
operator ngcore::FlatArray<T> () const
{
static_assert (BASE==0);
return FlatArray<T>(size, data);
return ngcore::FlatArray<T>(size, data);
}
};
@ -421,8 +422,9 @@ namespace netgen
}
// Only provide this function if T is archivable
template<typename T2=T>
auto DoArchive(Archive& archive) -> typename std::enable_if<is_archivable<T2>, void>::type
template<typename ARCHIVE>
auto DoArchive(ARCHIVE& archive)
-> typename std::enable_if_t<ARCHIVE::template is_archivable<T>, void>
{
if(archive.Output())
archive << size;
@ -531,13 +533,13 @@ namespace netgen
*/
template <class TA1, class TA2>
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 <typename T1, typename T2>
inline ostream & operator<< (ostream & s, const IndirectArray<T1,T2> & ia)
inline ostream & operator<< (ostream & s, const NgIndirectArray<T1,T2> & ia)
{
for (int i = ia.Begin(); i < ia.End(); i++)
s << i << ": " << ia[i] << endl;

View File

@ -7,6 +7,10 @@
/* Date: 04. Apr. 97 */
/**************************************************************************/
#include <mydefs.hpp>
#include "ngarray.hpp"
namespace netgen
{

View File

@ -7,9 +7,11 @@
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include <core/utils.hpp>
namespace netgen
{
using namespace ngcore;
/*
templates, global types, defines and variables
*/

View File

@ -7,7 +7,7 @@
namespace netgen
{
using namespace std;
using namespace ngcore;
using netgen::Point;
using netgen::Vec;

View File

@ -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
)

View File

@ -8,6 +8,11 @@
/* Redesigned by Wolfram Muehlhuber, May 1998 */
/* *************************************************************************/
#include <general/optmem.hpp>
#include <general/template.hpp>
#include <general/hashtabl.hpp>
#include "geomfuncs.hpp"
namespace netgen
{
@ -430,7 +435,7 @@ public:
// float cmin[dim], cmax[dim];
Point<dim> cmin, cmax;
// NgArray<T_ADTreeNode<dim>*> ela;
ClosedHashTable<T, T_ADTreeNode<dim,T>*> ela;
NgClosedHashTable<T, T_ADTreeNode<dim,T>*> ela;
BlockAllocator ball{sizeof(T_ADTreeNode<dim,T>)};
public:
@ -759,7 +764,7 @@ public:
Leaf() : n_elements(0)
{ }
void Add( ClosedHashTable<T, Leaf*> &leaf_index, const Point<2*dim> &ap, T aindex )
void Add( NgClosedHashTable<T, Leaf*> &leaf_index, const Point<2*dim> &ap, T aindex )
{
p[n_elements] = ap;
index[n_elements] = aindex;
@ -794,7 +799,7 @@ public:
private:
Node root;
ClosedHashTable<T, Leaf*> leaf_index;
NgClosedHashTable<T, Leaf*> leaf_index;
Point<dim> global_min, global_max;
double tol;

View File

@ -7,6 +7,12 @@
/* Date: 5. Aug. 95 */
/* *************************************************************************/
#include <mydefs.hpp>
#include <general/template.hpp>
#include "geomobjects.hpp"
#include <meshing/global.hpp>
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;

View File

@ -7,6 +7,9 @@
/* Date: 5. Aug. 95 */
/* *************************************************************************/
#include <mydefs.hpp>
#include "geom2d.hpp"
namespace netgen
{

View File

@ -7,6 +7,8 @@
/* Date: 20. Jul. 02 */
/* *************************************************************************/
#include "geomobjects.hpp"
#include "geomops.hpp"
namespace netgen
{

View File

@ -7,10 +7,13 @@
/* Date: 20. Jul. 02 */
/* *************************************************************************/
#include <core/array.hpp>
#include <general/ngarray.hpp>
namespace netgen
{
using namespace ngcore;
template <int D, typename T = double> class Vec;
template <int D, typename T = double> class Point;
@ -68,7 +71,8 @@ namespace netgen
operator const T* () const { return x; }
void DoArchive(Archive& archive)
template<typename ARCHIVE>
void DoArchive(ARCHIVE& archive)
{
for(int i=0; i<D; i++)
archive & x[i];
@ -170,6 +174,26 @@ namespace netgen
Vec<D> GetNormal () const;
};
template <int D>
inline ostream & operator<< (ostream & ost, const Vec<D> & a)
{
ost << "(";
for (int i = 0; i < D-1; i++)
ost << a(i) << ", ";
ost << a(D-1) << ")";
return ost;
}
template <int D>
inline ostream & operator<< (ostream & ost, const Point<D> & a)
{
ost << "(";
for (int i = 0; i < D-1; i++)
ost << a(i) << ", ";
ost << a(D-1) << ")";
return ost;
}
template<int D>
inline Vec<D> operator-(const Point<D>& p1, const Point<D>& p2)
{
@ -338,7 +362,7 @@ namespace netgen
}
template <typename T1, typename T2>
void Set (const IndirectArray<T1, T2> & points)
void Set (const NgIndirectArray<T1, T2> & points)
{
// Set (points[points.Begin()]);
Set (points[*points.Range().begin()]);
@ -348,7 +372,7 @@ namespace netgen
}
template <typename T1, typename T2>
void Add (const IndirectArray<T1, T2> & points)
void Add (const NgIndirectArray<T1, T2> & points)
{
// for (int i = points.Begin(); i < points.End(); i++)
for (int i : points.Range())

View File

@ -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 TA, class TB>
class SumExpr : public VecExpr<SumExpr<TA, TB> >
{
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 <typename TA, typename TB>
inline SumExpr<TA,TB>
operator+ (const VecExpr<TA> & a, const VecExpr<TB> & b)
{
return SumExpr<TA,TB> (static_cast <const TA&> (a), static_cast <const TB&> (b));
}
/*
template <int D1, int D2>
inline SumExpr<const Vec<D1>&, const Vec<D2>&>
operator+ (const Vec<D1> & a, const Vec<D2> & b)
{
return SumExpr<const Vec<D1>&, const Vec<D2>&> (a, b);
}
*/
/*
template <int D>
inline Vec<D> operator+ (const Vec<D> & a, const Vec<D> & b)
{
Vec<D> res;
for (int i = 0; i < D; i++)
res(i) = a(i) + b(i);
return res;
}
*/
template <int D>
inline Point<D> operator+ (const Point<D> & a, const Vec<D> & b)
{
Point<D> res;
for (int i = 0; i < D; i++)
res(i) = a(i) + b(i);
return res;
}
template <int D>
inline Vec<D> operator- (const Point<D> & a, const Point<D> & b)
{
Vec<D> res;
for (int i = 0; i < D; i++)
res(i) = a(i) - b(i);
return res;
}
template <int D>
inline Point<D> operator- (const Point<D> & a, const Vec<D> & b)
{
Point<D> res;
for (int i = 0; i < D; i++)
res(i) = a(i) - b(i);
return res;
}
template <int D>
inline Vec<D> operator- (const Vec<D> & a, const Vec<D> & b)
{
Vec<D> res;
for (int i = 0; i < D; i++)
res(i) = a(i) - b(i);
return res;
}
template <int D>
inline Vec<D> operator* (double s, const Vec<D> & b)
{
Vec<D> res;
for (int i = 0; i < D; i++)
res(i) = s * b(i);
return res;
}
template <int D>
inline double operator* (const Vec<D> & a, const Vec<D> & b)
{
double sum = 0;
for (int i = 0; i < D; i++)
sum += a(i) * b(i);
return sum;
}
template <int D>
inline Vec<D> operator- (const Vec<D> & b)
{
Vec<D> res;
for (int i = 0; i < D; i++)
res(i) = -b(i);
return res;
}
template <int D>
inline Point<D> & operator+= (Point<D> & a, const Vec<D> & b)
{
for (int i = 0; i < D; i++)
a(i) += b(i);
return a;
}
template <int D, typename T>
inline Point<D> & operator+= (Point<D> & a, const VecExpr<T> & b)
{
for (int i = 0; i < D; i++)
a(i) += b(i);
return a;
}
template <int D>
inline Vec<D> & operator+= (Vec<D> & a, const Vec<D> & b)
{
for (int i = 0; i < D; i++)
a(i) += b(i);
return a;
}
template <int D>
inline Point<D> & operator-= (Point<D> & a, const Vec<D> & b)
{
for (int i = 0; i < D; i++)
a(i) -= b(i);
return a;
}
template <int D, typename T>
inline Point<D> & operator-= (Point<D> & a, const VecExpr<T> & b)
{
for (int i = 0; i < D; i++)
a(i) -= b(i);
return a;
}
template <int D>
inline Vec<D> & operator-= (Vec<D> & a, const Vec<D> & b)
{
for (int i = 0; i < D; i++)
a(i) -= b(i);
return a;
}
template <int D>
inline Vec<D> & operator*= (Vec<D> & a, double s)
{
for (int i = 0; i < D; i++)
a(i) *= s;
return a;
}
template <int D>
inline Vec<D> & operator/= (Vec<D> & a, double s)
{
for (int i = 0; i < D; i++)
a(i) /= s;
return a;
}
// Matrix - Vector operations
/*
template <int H, int W>
inline Vec<H> operator* (const Mat<H,W> & m, const Vec<W> & v)
{
Vec<H> 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 <int H1, int W1, int H2, int W2>
inline Mat<H1,W2> operator* (const Mat<H1,W1> & a, const Mat<H2,W2> & b)
{
Mat<H1,W2> 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 <int H, int W>
inline Mat<W,H> Trans (const Mat<H,W> & m)
{
Mat<W,H> res;
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
res(j,i) = m(i,j);
return res;
}
template <int D>
inline ostream & operator<< (ostream & ost, const Vec<D> & a)
{
ost << "(";
for (int i = 0; i < D-1; i++)
ost << a(i) << ", ";
ost << a(D-1) << ")";
return ost;
}
template <int D>
inline ostream & operator<< (ostream & ost, const Point<D> & a)
{
ost << "(";
for (int i = 0; i < D-1; i++)
ost << a(i) << ", ";
ost << a(D-1) << ")";
return ost;
}
template <int D>
inline ostream & operator<< (ostream & ost, const Box<D> & b)
{
ost << b.PMin() << " - " << b.PMax();
return ost;
}
template <int H, int W>
inline ostream & operator<< (ostream & ost, const Mat<H,W> & 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

View File

@ -7,6 +7,8 @@
/* Date: 13. Feb. 98 */
/* *************************************************************************/
#include "geom3d.hpp"
#include "geomobjects.hpp"
namespace netgen
{

View File

@ -11,6 +11,9 @@
Affine - Linear mapping in 3D space
*/
#include "geom3d.hpp"
#include "geomfuncs.hpp"
namespace netgen
{

View File

@ -11,7 +11,11 @@
Data type dense matrix
*/
#include <mydefs.hpp>
#include "vector.hpp"
namespace netgen
{
class DenseMatrix
{
protected:
@ -406,5 +410,5 @@ extern ostream & operator<< (ostream & ost, const MatrixFixWidth<WIDTH> & m)
extern DLL_HEADER void CalcAtA (const DenseMatrix & a, DenseMatrix & m2);
extern DLL_HEADER void CalcInverse (const DenseMatrix & m1, DenseMatrix & m2);
} // namespace netgen
#endif

View File

@ -21,12 +21,9 @@
#include "../include/myadt.hpp"
namespace netgen
{
#include "vector.hpp"
#include "densemat.hpp"
#include "polynomial.hpp"
}
#endif

View File

@ -7,6 +7,8 @@
/* Date: 25. Nov. 99 */
/* *************************************************************************/
namespace netgen
{
class QuadraticPolynomial1V
{
@ -41,5 +43,5 @@ public:
double MaxUnitSquare ();
double MaxUnitTriangle ();
};
} // namespace netgen
#endif

View File

@ -7,8 +7,8 @@
/* Date: 01. Oct. 94 */
/* *************************************************************************/
namespace netgen
{
template <typename T>
class TFlatVector
@ -139,7 +139,8 @@ public:
~Vector ()
{ if (ownmem) delete [] data; }
virtual void DoArchive(Archive& ar)
template<typename ARCHIVE>
void DoArchive(ARCHIVE& ar)
{
auto size = s;
ar & ownmem & size;
@ -209,7 +210,7 @@ inline ostream & operator<< (ostream & ost, const FlatVector & v)
return ost;
}
} //namespace netgen
#endif

View File

@ -3,8 +3,9 @@
*/
#include <mystdlib.h>
#include "meshing.hpp"
#include <gprim/geom2d.hpp>
#include <gprim/geomfuncs.hpp>
#include "adfront2.hpp"
namespace netgen
{

View File

@ -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 <gprim/geomobjects.hpp>
#include <gprim/adtree.hpp>
#include "meshtype.hpp"
namespace netgen
{
///
class FrontPoint2
{
@ -275,9 +281,5 @@ public:
void PrintOpenSegments (ostream & ost) const;
};
#endif
} // namespace netgen
#endif // NETGEN_ADFRONT2_HPP

View File

@ -1,6 +1,7 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include <gprim/geomtest3d.hpp>
#include "adfront3.hpp"
/* ********************** FrontPoint ********************** */

View File

@ -11,7 +11,13 @@
Advancing front class for volume meshing
*/
#include <gprim/geomobjects.hpp>
#include <gprim/adtree.hpp>
#include "meshtype.hpp"
#include "geomsearch.hpp"
namespace netgen
{
/// Point in advancing front
class FrontPoint3
@ -315,7 +321,5 @@ private:
void RebuildInternalTables();
};
} // namespace netgen
#endif

View File

@ -7,10 +7,18 @@
/* Date: 23. Aug. 09 */
/**************************************************************************/
#include <gprim/geomobjects.hpp>
#include <gprim/transform3d.hpp>
#include "meshtype.hpp"
#include "meshclass.hpp"
struct Tcl_Interp;
namespace netgen
{
class Refinement;
struct ShapeProperties
{
optional<string> name;

View File

@ -1,5 +1,7 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include <core/array.hpp>
#include "bisect.hpp"
#include "validate.hpp"
#define noDEBUG

View File

@ -1,5 +1,13 @@
#ifndef BISECT
#define BISECT
#ifndef NETGEN_BISECT_HPP
#define NETGEN_BISECT_HPP
#include <mydefs.hpp>
#include <general/parthreads.hpp>
#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

View File

@ -1,10 +1,14 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "debugging.hpp"
#include "global.hpp"
#include <set>
#include <regex>
#include <mystdlib.h>
#include "global.hpp"
#include "debugging.hpp"
#include "boundarylayer.hpp"
#include "meshfunc.hpp"
namespace netgen
{

View File

@ -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);
@ -89,4 +91,5 @@ class BoundaryLayerTool
Vec<3> getEdgeTangent(PointIndex pi, int edgenr);
};
#endif
} // namespace netgen
#endif // NETGEN_BOUNDARYLAYER_HPP

View File

@ -1,6 +1,6 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "clusters.hpp"
namespace netgen
{

View File

@ -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

View File

@ -7,9 +7,8 @@
namespace netgen
{
using namespace std;
// bool rational = true;
static void ComputeGaussRule (int n, NgArray<double> & xi, NgArray<double> & wi)
{
xi.SetSize (n);

View File

@ -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 <mydefs.hpp>
#include <general/ngarray.hpp>
#include <gprim/geomobjects.hpp>
#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<DIM_SPACE,T> & x, Mat<DIM_SPACE,2,T> & jac) const;
};
#endif
} //namespace netgen
#endif // NETGEN_CURVEDELEMS_HPP

View File

@ -6,6 +6,7 @@
namespace netgen
{
using namespace std;
void DelaunayTrig::CalcCenter (FlatArray<Point<2>, PointIndex> points)
{
Point<2> p1 = points[pnums[0]];

View File

@ -1,6 +1,10 @@
#ifndef NETGEN_FINDIP_HPP
#define NETGEN_FINDIP_HPP
// find inner point
namespace netgen
{
inline void Minimize (const NgArray<Vec3d> & a,
const NgArray<double> & c,
@ -188,5 +192,7 @@ inline int FindInnerPoint (POINTArray & points,
return (f < -1e-5 * hmax);
}
} // namespace netgen
#endif // FILE_FINDINNERPOINT_HPP

View File

@ -1,5 +1,11 @@
#ifndef NETGEN_FINDIP2_HPP
#define NETGEN_FINDIP2_HPP
// find inner point
namespace netgen
{
template <typename POINTArray, typename FACEArray>
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

View File

@ -1,5 +1,6 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "geomsearch.hpp"
#include "adfront3.hpp"
namespace netgen

View File

@ -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

View File

@ -1,11 +1,12 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "global.hpp"
#include <netgen_version.hpp>
#include "msghandler.hpp"
#include "meshtype.hpp"
namespace netgen
{
class NetgenGeometry;
class TraceGlobal
{
string name;

View File

@ -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 <mydefs.hpp>
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

View File

@ -1,6 +1,5 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "hprefinement.hpp"
namespace netgen
{

View File

@ -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

View File

@ -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<std::tuple<PointIndex,PointIndex>> & 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

View File

@ -1,6 +1,8 @@
#ifndef FILE_IMPROVE3
#define FILE_IMPROVE3
namespace netgen
{
extern double CalcTotalBad (const Mesh::T_POINTS & points,
const Array<Element, ElementIndex> & elements,
@ -136,6 +138,5 @@ public:
inline void UnSetNV(void) {onplane = false;}
};
} // namespace netgen
#endif

View File

@ -5,6 +5,7 @@
#include "../general/gzstream.h"
#include <core/register_archive.hpp>
#include "basegeom.hpp"
namespace netgen
{
@ -292,6 +293,12 @@ namespace netgen
// #endif
}
shared_ptr<NetgenGeometry> Mesh :: GetGeometry() const
{
static auto global_geometry = make_shared<NetgenGeometry>();
return geometry ? geometry : global_geometry;
}
void Mesh :: SetCommunicator(NgMPI_Comm acomm)
{
this->comm = acomm;

View File

@ -1,5 +1,5 @@
#ifndef MESHCLASS
#define MESHCLASS
#ifndef NETGEN_MESHCLASS_HPP
#define NETGEN_MESHCLASS_HPP
/**************************************************************************/
/* File: meshclass.hpp */
@ -13,8 +13,16 @@
#include<filesystem>
#include <gprim/adtree.hpp>
#include <gprim/transform3d.hpp>
#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<NetgenGeometry> GetGeometry() const
{
static auto global_geometry = make_shared<NetgenGeometry>();
return geometry ? geometry : global_geometry;
}
DLL_HEADER shared_ptr<NetgenGeometry> GetGeometry() const;
void SetGeometry (shared_ptr<NetgenGeometry> geom)
{
geometry = geom;
@ -993,6 +997,4 @@ namespace netgen
}
#endif
#endif // NETGEN_MESHCLASS_HPP

View File

@ -7,7 +7,12 @@
/* Date: 26. Jan. 98 */
/**************************************************************************/
#include <mydefs.hpp>
#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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -8,6 +8,13 @@
/* Date: 01. Okt. 95 */
/**************************************************************************/
#include <mydefs.hpp>
#include <general/template.hpp>
#include <gprim/geom3d.hpp>
#include <linalg.hpp>
#include "msghandler.hpp"
namespace netgen
{

View File

@ -7,6 +7,8 @@
/* Date: 20. Nov. 99 */
/**************************************************************************/
#include <general/mystring.hpp>
namespace netgen
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1059,7 +1059,7 @@ namespace netgen
// auto begin = r.First();
// auto end = r.Next();
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
ClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
NgClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
// for (PointIndex v = begin+PointIndex::BASE;
// v < end+PointIndex::BASE; v++)
for (PointIndex v : r+PointIndex::BASE)
@ -1124,7 +1124,7 @@ namespace netgen
// auto begin = r.First();
// auto end = r.Next();
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
ClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
NgClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
/*
for (PointIndex v = begin+PointIndex::BASE;
v < end+PointIndex::BASE; v++)

View File

@ -190,13 +190,13 @@ private:
STLGeometry * geometry;
const STLChart * chart;
// NgArray<STLBoundarySeg> boundary;
ClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
NgClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
unique_ptr<BoxTree<2,INDEX_2>> searchtree;
public:
STLBoundary(STLGeometry * ageometry);
~STLBoundary() {}
void Clear() { /* boundary.SetSize(0); */ boundary_ht = ClosedHashTable<INDEX_2,STLBoundarySeg>(); }
void Clear() { /* boundary.SetSize(0); */ boundary_ht = NgClosedHashTable<INDEX_2,STLBoundarySeg>(); }
void SetChart (const STLChart * achart) { chart = achart; }
//don't check, if already exists!
// void AddNewSegment(const STLBoundarySeg & seg) {boundary.Append(seg);};