2009-01-13 04:40:13 +05:00
|
|
|
#ifndef FILE_BRICK
|
|
|
|
#define FILE_BRICK
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/* File: brick.hpp */
|
|
|
|
/* Author: Joachim Schoeberl */
|
|
|
|
/* Date: 11. Mar. 98 */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
namespace netgen
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
brick geometry, has several surfaces
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
*/
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class Parallelogram3d : public Surface
|
|
|
|
{
|
|
|
|
Point<3> p1, p2, p3, p4;
|
|
|
|
Vec<3> v12, v13;
|
|
|
|
Vec<3> n;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
public:
|
|
|
|
Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
2018-12-06 21:53:44 +05:00
|
|
|
// default constructor for archive
|
|
|
|
Parallelogram3d() {}
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual ~Parallelogram3d ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2018-12-06 21:53:44 +05:00
|
|
|
virtual void DoArchive(Archive& ar)
|
|
|
|
{
|
|
|
|
Surface::DoArchive(ar);
|
|
|
|
ar & p1 & p2 & p3 & p4 & v12 & v13 & n;
|
|
|
|
}
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
void SetPoints (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual double CalcFunctionValue (const Point<3> & point) const;
|
|
|
|
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
|
|
|
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
|
|
|
virtual double HesseNorm () const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual Point<3> GetSurfacePoint () const;
|
|
|
|
virtual void Print (ostream & str) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
|
|
|
const Box<3> & boundingbox,
|
|
|
|
double facets) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
protected:
|
|
|
|
void CalcData();
|
|
|
|
};
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class Brick : public Primitive
|
|
|
|
{
|
|
|
|
Point<3> p1, p2, p3, p4;
|
|
|
|
Vec<3> v12, v13, v14;
|
2019-07-09 13:39:16 +05:00
|
|
|
// NgArray<OneSurfacePrimitive*> faces;
|
|
|
|
NgArray<Plane*> faces;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
public:
|
|
|
|
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
|
2018-12-06 21:53:44 +05:00
|
|
|
// default constructor for archive
|
|
|
|
Brick() {}
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual ~Brick ();
|
2018-12-06 21:53:44 +05:00
|
|
|
|
|
|
|
virtual void DoArchive(Archive& ar)
|
|
|
|
{
|
|
|
|
Primitive::DoArchive(ar);
|
|
|
|
ar & p1 & p2 & p3 & p4 & v12 & v13 & v14 & faces;
|
|
|
|
}
|
2009-09-07 17:50:13 +06:00
|
|
|
static Primitive * CreateDefault ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual Primitive * Copy () const;
|
|
|
|
virtual void Transform (Transformation<3> & trans);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
|
|
|
double eps) const;
|
|
|
|
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
|
|
|
|
const Vec<3> & v,
|
2009-01-13 04:40:13 +05:00
|
|
|
double eps) const;
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
|
|
|
|
const Vec<3> & v1,
|
|
|
|
const Vec<3> & v2,
|
|
|
|
double eps) const;
|
|
|
|
|
|
|
|
virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
|
|
|
|
const Vec<3> & v1,
|
|
|
|
const Vec<3> & v2,
|
|
|
|
double eps) const;
|
|
|
|
|
|
|
|
virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
|
|
|
|
const Vec<3> & v,
|
|
|
|
const Vec<3> & v2,
|
|
|
|
const Vec<3> & m,
|
|
|
|
double eps) const;
|
|
|
|
|
|
|
|
|
|
|
|
virtual int GetNSurfaces() const
|
2009-01-13 04:40:13 +05:00
|
|
|
{ return 6; }
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual Surface & GetSurface (int i)
|
2009-01-13 04:40:13 +05:00
|
|
|
{ return *faces[i]; }
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual const Surface & GetSurface (int i) const
|
2009-01-13 04:40:13 +05:00
|
|
|
{ return *faces[i]; }
|
|
|
|
|
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
|
|
|
|
virtual void SetPrimitiveData (NgArray<double> & coeffs);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual void Reduce (const BoxSphere<3> & box);
|
|
|
|
virtual void UnReduce ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
protected:
|
|
|
|
void CalcData();
|
|
|
|
};
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class OrthoBrick : public Brick
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
Point<3> pmin, pmax;
|
|
|
|
public:
|
|
|
|
OrthoBrick (const Point<3> & ap1, const Point<3> & ap2);
|
2018-12-06 21:53:44 +05:00
|
|
|
// default constructor for archive
|
|
|
|
OrthoBrick() {}
|
|
|
|
|
|
|
|
virtual void DoArchive(Archive& ar)
|
|
|
|
{
|
|
|
|
Brick::DoArchive(ar);
|
|
|
|
ar & pmin & pmax;
|
|
|
|
}
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
|
|
|
virtual void Reduce (const BoxSphere<3> & box);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
#endif
|