walberla::geometry Namespace Reference

Namespaces

 containment_octree
 
 initializer
 

Classes

class  AbstractBody
 
class  BasicVoxelFileReader
 Provides a low level reader for waLBerla geometry files. More...
 
class  BinaryRawFile
 
class  BinaryRawFileInterpolator
 
class  BodyLogicalAND
 
class  BodyLogicalNOT
 
class  BodyLogicalOperationBinary
 Class representing a union, difference, etc. More...
 
class  BodyLogicalOR
 
class  BodyLogicalXOR
 
struct  CellAABB
 Helper class to provide a cell based axis-aligned bounding box. More...
 
class  ContainmentOctree
 
class  Cylinder
 Class representing a Cylinder. More...
 
class  DynamicBody
 
class  Ellipsoid
 Class representing an Ellipsoid in 3D. More...
 
class  GrayScaleImage
 A gray scale image. More...
 
class  LessThan
 Helper class, used in TriangleMesh::removeDuplicateVertices. More...
 
class  RGBAImage
 A gray scale image. More...
 
class  Sphere
 Class representing a Sphere. More...
 
class  Torus
 Class representing a Torus. More...
 
class  TriangleMesh
 Class for storing a triangle mesh. More...
 
struct  TriangleMeshNode
 Used only internally in function "TriangleMesh::split( vector<TriangleMesh>& meshes )". More...
 
class  VoxelFileReader
 Provides a reader for waLBerla geometry files. More...
 

Enumerations

enum  FastOverlapResult { CONTAINED_INSIDE_BODY, COMPLETELY_OUTSIDE, PARTIAL_OVERLAP, DONT_KNOW }
 
enum  State { VERTEX, NORMAL, FACE }
 

Functions

template<>
real_t overlapFraction (const AABB &body, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx, uint_t)
 
template<>
FastOverlapResult fastOverlapCheck (const AABB &body, const AABB &cell)
 
template<>
bool contains (const AABB &aabb, const Vector3< real_t > &point)
 
Sphere sphereFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a Sphere. More...
 
Cylinder cylinderFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a Cylinder. More...
 
Torus torusFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a Torus. More...
 
Ellipsoid ellipsoidFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns an Ellipsoid. More...
 
AABB AABBFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a box. More...
 
BodyLogicalAND< Sphere, AABB > sphereSliceFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a difference/union/... More...
 
BodyLogicalAND< Sphere, BodyLogicalNOT< Sphere > > hollowSphereFromConfig (const Config::BlockHandle &block)
 
shared_ptr< AbstractBodybodyFromConfig (const Config::BlockHandle &block)
 Parses a configuration block and returns a body via dynamic polymorphism. More...
 
shared_ptr< AbstractBodybodyANDFromConfig (const Config::BlockHandle &block)
 
shared_ptr< AbstractBodybodyORFromConfig (const Config::BlockHandle &block)
 
shared_ptr< AbstractBodybodyXORFromConfig (const Config::BlockHandle &block)
 
shared_ptr< AbstractBodybodyNOTFromConfig (const Config::BlockHandle &block)
 
template<typename A >
bool contains (const BodyLogicalNOT< A > &body, const Vector3< real_t > &point)
 
template<typename A , typename B >
bool contains (const BodyLogicalAND< A, B > &body, const Vector3< real_t > &point)
 
template<typename A , typename B >
bool contains (const BodyLogicalOR< A, B > &body, const Vector3< real_t > &point)
 
template<typename A , typename B >
bool contains (const BodyLogicalXOR< A, B > &body, const Vector3< real_t > &point)
 
template<typename Body >
real_t overlapFraction (const Body &body, const Vector3< real_t > &cellMidpoint, real_t dx, uint_t maxDepth=4)
 Returns the overlap fraction between a body and a cell. More...
 
template<typename Body >
real_t overlapFraction (const Body &body, const Vector3< real_t > &cellMidpoint, real_t dx, int maxDepth)
 
template<typename Body >
real_t overlapFraction (const Body &body, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx, uint_t maxDepth=4)
 
template<typename Body >
bool contains (const Body &body, const Vector3< real_t > &point)
 Test if a point in space lies inside a body. More...
 
template<typename Body >
FastOverlapResult fastOverlapCheck (const Body &body, const AABB &block)
 Determines in a fast way ( for example using a bounding box) if a body and a block overlap when no fast computation is possible return DONT_KNOW. More...
 
template<typename Body >
FastOverlapResult fastOverlapCheck (const Body &body, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 Determines in a fast way (bounding box etc) if a body and a block overlap when no fast computation is possible return DONT_KNOW. More...
 
template<typename Body >
real_t cellSupersampling (const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx, const Body &body, uint_t maxDepth=4, uint_t depth=uint_t(0u))
 
template<>
FastOverlapResult fastOverlapCheck (const Cylinder &cyl, const AABB &box)
 
template<>
bool contains (const Cylinder &cyl, const Vector3< real_t > &point)
 
template<typename Body >
shared_ptr< DynamicBody< Body > > make_DynamicBody (Body body)
 
template<>
FastOverlapResult fastOverlapCheck (const AbstractBody &body, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const AbstractBody &body, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const AbstractBody &body, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const Ellipsoid &ellipsoid, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const Ellipsoid &ellipsoid, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const Ellipsoid &ellipsoid, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const Sphere &sphere, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const Sphere &sphere, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const Sphere &sphere, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const Torus &torus, const AABB &box)
 
template<>
bool contains (const Torus &torus, const Vector3< real_t > &point)
 
template<typename BoundaryHandling >
void initBoundaryHandling (StructuredBlockStorage &blocks, BlockDataID boundaryHandlingId, const Config::BlockHandle &geometryBlock)
 Convenience function for setting up boundary handling via a block in the configuration file. More...
 
template<typename BoundaryHandling >
void initBoundaryHandling (StructuredBlockStorage &blocks, BlockDataID boundaryHandlingId, const Config &config)
 
template<typename BoundaryHandling >
void setNonBoundaryCellsToDomain (StructuredBlockStorage &blocks, BlockDataID boundaryHandlingId)
 
template<typename FlagField_T >
void setNonBoundaryCellsToDomain (StructuredBlockStorage &blocks, BlockDataID flagFieldID, field::FlagUID fluidFlagID)
 
template<typename T , typename G >
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const TriangleMesh &mesh)
 Packs a TriangleMesh into a SendBuffer. More...
 
template<typename T >
mpi::GenericRecvBuffer< T > & operator>> (mpi::GenericRecvBuffer< T > &buf, TriangleMesh &mesh)
 Unpacks a TriangleMesh from a RecvBuffer. More...
 
void readMesh (const std::string &meshFilename, TriangleMesh &mesh)
 Reads mesh from file. More...
 
void writeMesh (const std::string &meshFilename, const TriangleMesh &mesh)
 writes a mesh to file More...
 
void readAndBroadcastMesh (const std::string &meshFilename, TriangleMesh &mesh)
 Reads mesh from file on root process and broadcasts it to all other processes. More...
 
void writeMeshOnRoot (const std::string &meshFilename, const TriangleMesh &mesh)
 writes a mesh to file on root process More...
 
void readFaceVertex (std::istream &is, TriangleMesh::index_t &vertexIdx, TriangleMesh::index_t &textureIdx, TriangleMesh::index_t &normalIdx)
 
void readMeshObj (std::istream &is, TriangleMesh &mesh)
 Reads mesh from input stream in obj file format. More...
 
void writeMeshObj (std::ostream &os, const TriangleMesh &mesh)
 Writes mesh to output stream in obj format. More...
 
void removeComments (std::istream &is, std::ostream &os)
 
void readMeshPov (std::istream &is, TriangleMesh &mesh, bool clear=true)
 Reads mesh from input stream in povray's mesh2 format. More...
 
void writeMeshPov0 (std::ostream &os, const TriangleMesh &mesh, const size_t itemsPerLine)
 
void writeMeshPov (std::ostream &os, const TriangleMesh &mesh, size_t itemsPerLine=5u, size_t itemsPerMesh=0u)
 Writes mesh in povray's mesh2 format. More...
 
static void skipComments (std::istream &is)
 
void readMeshOff (std::istream &is, TriangleMesh &mesh)
 Reads mesh from input stream in Geomview Object File Format. More...
 
void writeMeshOff (std::ostream &os, const TriangleMesh &mesh)
 Writes a mesh to an output stream in Geomview Object File Format. More...
 
void writeMeshVtp (std::ostream &os, const TriangleMesh &mesh)
 Writes a mesh to an output stream in VTK Poly Data format. More...
 
template<typename T >
static BinaryRawFile loadFile (const std::string &filename, const Vector3< uint_t > &size)
 
std::ostream & operator<< (std::ostream &os, const RGBAImage::pixel_t &pixel)
 
std::istream & operator>> (std::istream &is, RGBAImage::pixel_t &pixel)
 
CellAABB toCellAABB (const CellInterval &cellInterval)
 Converts a CellInterval to a CellAABB. More...
 
void validateCellInterval (const CellInterval &cellInterval)
 Validate if the given CellInterval can be converted to a CellAABB. More...
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Sphere &peSphere, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Sphere &peSphere, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const pe::Sphere &peSphere, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Squirmer &peSquirmer, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Squirmer &peSquirmer, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const pe::Squirmer &peSquirmer, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Plane &pePlane, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::Plane &pePlane, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const pe::Plane &pePlane, const Vector3< real_t > &point)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::RigidBody &peBody, const AABB &box)
 
template<>
FastOverlapResult fastOverlapCheck (const pe::RigidBody &peBody, const Vector3< real_t > &cellMidpoint, const Vector3< real_t > &dx)
 
template<>
bool contains (const pe::RigidBody &peBody, const Vector3< real_t > &point)
 
Geometry functions
void getClosestLineBoxPoints (const Vector3< real_t > &p1, const Vector3< real_t > &p2, const Vector3< real_t > &c, const Matrix3< real_t > &R, const Vector3< real_t > &side, Vector3< real_t > &lret, Vector3< real_t > &bret)
 Find the closest points on a box and a line segment. More...
 
void getClosestLineSegmentPoints (const Vector3< real_t > &a1, const Vector3< real_t > &a2, const Vector3< real_t > &b1, const Vector3< real_t > &b2, Vector3< real_t > &cp1, Vector3< real_t > &cp2)
 Find the closest points on two line segments. More...
 
void intersectLines (const Vector3< real_t > &o1, const Vector3< real_t > &d1, const Vector3< real_t > &o2, const Vector3< real_t > &d2, real_t &s, real_t &t)
 Find the intersection point or the point of the closest approach between two straight. More...
 
bool originInTetrahedron (const Vector3< real_t > &A, const Vector3< real_t > &B, const Vector3< real_t > &C, const Vector3< real_t > &D)
 Estimates whether or not the origin lies within the given tetrahedron. More...
 
bool pointInTetrahedron (const Vector3< real_t > &A, const Vector3< real_t > &B, const Vector3< real_t > &C, const Vector3< real_t > &D, const Vector3< real_t > &point)
 Estimates whether or not a given point lies within the given tetrahedron. More...
 
bool pointInFrontOfPlane (const Vector3< real_t > &normal, const Vector3< real_t > &pointOnPlane, const Vector3< real_t > &point)
 Estimates whether a given point is in front of a plane. More...
 

Enumeration Type Documentation

Enumerator
CONTAINED_INSIDE_BODY 
COMPLETELY_OUTSIDE 
PARTIAL_OVERLAP 
DONT_KNOW 
Enumerator
VERTEX 
NORMAL 
FACE 

Function Documentation

AABB walberla::geometry::AABBFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a box.

Example block: box{ min <1,2,3>; max <5,4,3>; }

shared_ptr< AbstractBody > walberla::geometry::bodyANDFromConfig ( const Config::BlockHandle &  block)
shared_ptr< AbstractBody > walberla::geometry::bodyFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a body via dynamic polymorphism.

shared_ptr< AbstractBody > walberla::geometry::bodyNOTFromConfig ( const Config::BlockHandle &  block)
shared_ptr< AbstractBody > walberla::geometry::bodyORFromConfig ( const Config::BlockHandle &  block)
shared_ptr< AbstractBody > walberla::geometry::bodyXORFromConfig ( const Config::BlockHandle &  block)
template<typename Body >
real_t walberla::geometry::cellSupersampling ( const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx,
const Body &  body,
uint_t  maxDepth = 4,
uint_t  depth = uint_t(0u) 
)
template<>
bool walberla::geometry::contains ( const AABB &  aabb,
const Vector3< real_t > &  point 
)
inline
template<>
bool walberla::geometry::contains ( const Torus torus,
const Vector3< real_t > &  point 
)
template<>
bool walberla::geometry::contains ( const Cylinder cyl,
const Vector3< real_t > &  point 
)
template<>
bool walberla::geometry::contains ( const pe::Sphere peSphere,
const Vector3< real_t > &  point 
)
inline
template<typename Body >
bool walberla::geometry::contains ( const Body &  body,
const Vector3< real_t > &  point 
)

Test if a point in space lies inside a body.

This function has to be specialized for every body. There is no default implementation.

template<>
bool walberla::geometry::contains ( const Sphere sphere,
const Vector3< real_t > &  point 
)
template<>
bool walberla::geometry::contains ( const AbstractBody body,
const Vector3< real_t > &  point 
)
inline
template<>
bool walberla::geometry::contains ( const pe::Squirmer peSquirmer,
const Vector3< real_t > &  point 
)
inline
template<typename A >
bool walberla::geometry::contains ( const BodyLogicalNOT< A > &  body,
const Vector3< real_t > &  point 
)
template<typename A , typename B >
bool walberla::geometry::contains ( const BodyLogicalAND< A, B > &  body,
const Vector3< real_t > &  point 
)
template<typename A , typename B >
bool walberla::geometry::contains ( const BodyLogicalOR< A, B > &  body,
const Vector3< real_t > &  point 
)
template<typename A , typename B >
bool walberla::geometry::contains ( const BodyLogicalXOR< A, B > &  body,
const Vector3< real_t > &  point 
)
template<>
bool walberla::geometry::contains ( const Ellipsoid ellipsoid,
const Vector3< real_t > &  point 
)
template<>
bool walberla::geometry::contains ( const pe::Plane pePlane,
const Vector3< real_t > &  point 
)
inline
template<>
bool walberla::geometry::contains ( const pe::RigidBody peBody,
const Vector3< real_t > &  point 
)
inline
Cylinder walberla::geometry::cylinderFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a Cylinder.

Example block: Cylinder{ min <1,2,3>; max <5,4,3>; radius 3; }

Ellipsoid walberla::geometry::ellipsoidFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns an Ellipsoid.

Example block: Ellipsoid{ midpoint <1,2,3>; radii <5,4,3>; axis1 <1,0,0>; axis2 <0,1,0> }

For the semantic of the parameters see constructor of Ellipsoid

template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Sphere peSphere,
const AABB &  box 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const AABB &  body,
const AABB &  cell 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Torus torus,
const AABB &  box 
)
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Sphere sphere,
const AABB &  box 
)
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Cylinder cyl,
const AABB &  box 
)
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Sphere peSphere,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Sphere sphere,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const AbstractBody body,
const AABB &  box 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const AbstractBody body,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Squirmer peSquirmer,
const AABB &  box 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Squirmer peSquirmer,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Ellipsoid ellipsoid,
const AABB &  box 
)
template<typename Body >
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Body &  body,
const AABB &  block 
)

Determines in a fast way ( for example using a bounding box) if a body and a block overlap when no fast computation is possible return DONT_KNOW.

template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Ellipsoid ellipsoid,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
template<typename Body >
FastOverlapResult walberla::geometry::fastOverlapCheck ( const Body &  body,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)

Determines in a fast way (bounding box etc) if a body and a block overlap when no fast computation is possible return DONT_KNOW.

template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Plane pePlane,
const AABB &  box 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::Plane pePlane,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::RigidBody peBody,
const AABB &  box 
)
inline
template<>
FastOverlapResult walberla::geometry::fastOverlapCheck ( const pe::RigidBody peBody,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx 
)
inline
void walberla::geometry::getClosestLineBoxPoints ( const Vector3< real_t > &  p1,
const Vector3< real_t > &  p2,
const Vector3< real_t > &  c,
const Matrix3< real_t > &  R,
const Vector3< real_t > &  side,
Vector3< real_t > &  lret,
Vector3< real_t > &  bret 
)

Find the closest points on a box and a line segment.

Parameters
p1The first end point of the line segment.
p2The second end point of the line segment.
cThe center position of the box.
RThe rotation of the box.
sideThe box's sides lengths.
[out]lretThe closest point on the line.
[out]bretThe closest point on the box.
Returns
void

This function calculates the closest points between a box and a line segment. The variable lret will be set to the closest point on the line, the variable bret to the closest point on the box. In case p1 lies outside the box and the line intersects the box, the intersection point is returned (in both variables). In case p1 lies inside the box, both lret and bret will refer to p1.

lineBox.png
void walberla::geometry::getClosestLineSegmentPoints ( const Vector3< real_t > &  a1,
const Vector3< real_t > &  a2,
const Vector3< real_t > &  b1,
const Vector3< real_t > &  b2,
Vector3< real_t > &  cp1,
Vector3< real_t > &  cp2 
)

Find the closest points on two line segments.

Parameters
a1The first end point of the first line segment.
a2The second end point of the first line segment.
b1The first end point of the second line segment.
b2The second end point of the second line segment.
[out]cp1The closest point on line one.
[out]cp2The closest point on line two.
Returns
void

Given the two line segments A and B, this function returns the points that are closest to each other. In the case of parallel lines, where multiple solutions are possible, a solution involving the endpoint of at least one line will be returned. This will also work correctly for zero length lines, e.g. if a1 = a2 and/or b1 = b2.

BodyLogicalAND< Sphere, BodyLogicalNOT< Sphere > > walberla::geometry::hollowSphereFromConfig ( const Config::BlockHandle &  block)
template<typename BoundaryHandling >
void walberla::geometry::initBoundaryHandling ( StructuredBlockStorage &  blocks,
BlockDataID  boundaryHandlingId,
const Config::BlockHandle &  geometryBlock 
)

Convenience function for setting up boundary handling via a block in the configuration file.

This function groups together the most common initializers for a boundary handling. For a detailed documentation on the format of the configuration block look at the initializer documentation:

Initializer Functionality Subblock name
initializer::BoundaryFromCellInterval Initializes a boundary handler using a CellInterval (works for both boundary handlings and boundary handling collections). CellInterval
initializer::BoundaryFromDomainBorder Sets a boundary condition at a certain border of the domain (borders are specified by directions). Border
initializer::BoundaryFromImage<GrayScaleImage> GrayScaleImage
initializer::BoundaryFromImage<RGBAImage> RGBAImage
initializer::BoundaryFromVoxelFile Sets boundary conditions using information obtained from a voxel file. VoxelFile
initializer::BoundaryFromBody Initializes a boundary handler using a Body (works for both boundary handlings and boundary handling collections). Body

Example for a configuration block:

Boundaries
{
Border { direction W; walldistance -1; Velocity0 {} }
Border { direction E; walldistance -1; Pressure1 {} }
Border { direction S,N; walldistance -1; NoSlip {} }
Body { shape Sphere; radius 2; midpoint <10,10,10>; NoSlip {} }
Image
{
file obstacle.png;
extrusionCoordinate 2;
rescaleToDomain true;
BoundaryValueMapping {
NoSlip {}
value 0;
}
}
}
template<typename BoundaryHandling >
void walberla::geometry::initBoundaryHandling ( StructuredBlockStorage &  blocks,
BlockDataID  boundaryHandlingId,
const Config &  config 
)
void walberla::geometry::intersectLines ( const Vector3< real_t > &  o1,
const Vector3< real_t > &  d1,
const Vector3< real_t > &  o2,
const Vector3< real_t > &  d2,
real_t s,
real_t t 
)

Find the intersection point or the point of the closest approach between two straight.

lines \( l_1(s) = o_1+sd_1 \) and \( l_2(t) = o_2+td_2 \).

Parameters
o1A point on line \( l_1 \).
d1The direction of line \( l_1 \).
o2A point on line \( l_2 \).
d2The direction of line \( l_2 \).
[out]sThe resolved parameter for line \( l_1 \).
[out]tThe resolved parameter for line \( l_2 \).
Returns
void

\[ o_1+sd_1 = o_2+td_2 \]

\[ \Longleftrightarrow \]

\[ s = \frac{\det(o_2-o_1,d_2,d_1 \times d_2)}{\left \Vert d_1 \times d_2 \right \| ^2 } \]

\[ t = \frac{\det(o_2-o_1,d_1,d_1 \times d_2)}{\left \Vert d_1 \times d_2 \right \| ^2 } \]

template<typename T >
static BinaryRawFile walberla::geometry::loadFile ( const std::string &  filename,
const Vector3< uint_t > &  size 
)
static
template<typename Body >
shared_ptr<DynamicBody<Body> > walberla::geometry::make_DynamicBody ( Body  body)
template<typename T , typename G >
mpi::GenericSendBuffer<T,G>& walberla::geometry::operator<< ( mpi::GenericSendBuffer< T, G > &  buf,
const TriangleMesh mesh 
)

Packs a TriangleMesh into a SendBuffer.

Parameters
bufThe SendBuffer object mesh is packed into.
meshThe TriangleMesh object to be packed into buf.
Returns
A reference to buf.
std::ostream & walberla::geometry::operator<< ( std::ostream &  os,
const RGBAImage::pixel_t pixel 
)
template<typename T >
mpi::GenericRecvBuffer<T>& walberla::geometry::operator>> ( mpi::GenericRecvBuffer< T > &  buf,
TriangleMesh mesh 
)

Unpacks a TriangleMesh from a RecvBuffer.

Parameters
bufThe RecvBuffer object mesh is unpacked from.
meshThe TriangleMesh object buf is unpacked into.
Returns
A reference to buf.
std::istream & walberla::geometry::operator>> ( std::istream &  is,
RGBAImage::pixel_t pixel 
)
bool walberla::geometry::originInTetrahedron ( const Vector3< real_t > &  A,
const Vector3< real_t > &  B,
const Vector3< real_t > &  C,
const Vector3< real_t > &  D 
)
inline

Estimates whether or not the origin lies within the given tetrahedron.

Parameters
AVertex that sees the triangle BCD in counterclockwise order.
BVertex that sees the triangle ADC in counterclockwise order.
CVertex that sees the triangle ABD in counterclockwise order.
DVertex that sees the triangle ACB in counterclockwise order.
Returns
true if the origin lies within the tetrahedron, otherwise false.
Note
Points on the surface of the tetrahedron are considered inside.
Todo:
Review documentation
template<>
real_t walberla::geometry::overlapFraction ( const AABB &  body,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx,
uint_t   
)
inline
template<typename Body >
real_t walberla::geometry::overlapFraction ( const Body &  body,
const Vector3< real_t > &  cellMidpoint,
real_t  dx,
uint_t  maxDepth = 4 
)

Returns the overlap fraction between a body and a cell.

Specialize this function directly for bodies where the overlap can be computed analytically. The default implementation does a cell super-sampling, using the contains() method multiple times.

Parameters
bodythe body object
cellMidpointmidpoint of the cell in global coordinates
dxthe edge length(s) of the cell, dx or (dx, dy, dz)
maxDepthsub sampling depth: the cell edge is divided in half maxDepth+1 times. Values less than zero result in no subdivisions, making this function behave like contains().
template<typename Body >
real_t walberla::geometry::overlapFraction ( const Body &  body,
const Vector3< real_t > &  cellMidpoint,
real_t  dx,
int  maxDepth 
)
template<typename Body >
real_t walberla::geometry::overlapFraction ( const Body &  body,
const Vector3< real_t > &  cellMidpoint,
const Vector3< real_t > &  dx,
uint_t  maxDepth = 4 
)
bool walberla::geometry::pointInFrontOfPlane ( const Vector3< real_t > &  normal,
const Vector3< real_t > &  pointOnPlane,
const Vector3< real_t > &  point 
)
inline

Estimates whether a given point is in front of a plane.

Parameters
normalThe normal of the plane, does not have to be normalised.
pointOnPlaneAny point on the Plane.
pointThe point whose position is check for being in front of the plane.
Returns
true if the origin lies in front of the plane, otherwise false.
Note
Points on the surface of the plane are considered not in front of the plane.
Todo:
Review documentation
bool walberla::geometry::pointInTetrahedron ( const Vector3< real_t > &  A,
const Vector3< real_t > &  B,
const Vector3< real_t > &  C,
const Vector3< real_t > &  D,
const Vector3< real_t > &  point 
)
inline

Estimates whether or not a given point lies within the given tetrahedron.

Parameters
AVertex that sees the triangle BCD in counterclockwise order.
BVertex that sees the triangle ADC in counterclockwise order.
CVertex that sees the triangle ABD in counterclockwise order.
DVertex that sees the triangle ACB in counterclockwise order.
pointThe point whose position is check for being inside the tetrahedron.
Returns
true if the origin lies within the tetrahedron, otherwise false.
Note
Points on the surface of the tetrahedron are considered inside.
Todo:
Review documentation
void walberla::geometry::readAndBroadcastMesh ( const std::string &  meshFilename,
TriangleMesh mesh 
)

Reads mesh from file on root process and broadcasts it to all other processes.

Mesh format is detected by file ending.

Parameters
fileNameFilename of mesh. Supported formats are obj, pov and off. Format is detected by file ending
meshobject where the mesh is stored, if the given mesh is not empty, all contents are cleared
void walberla::geometry::readFaceVertex ( std::istream &  is,
TriangleMesh::index_t vertexIdx,
TriangleMesh::index_t textureIdx,
TriangleMesh::index_t normalIdx 
)
void walberla::geometry::readMesh ( const std::string &  meshFilename,
TriangleMesh mesh 
)

Reads mesh from file.

Mesh format is detected by file ending.

Parameters
fileNameFilename of mesh. Supported formats are obj, pov and off. Format is detected by file ending
meshobject where the mesh is stored, if the given mesh is not empty, all contents are cleared
void walberla::geometry::readMeshObj ( std::istream &  is,
TriangleMesh mesh 
)

Reads mesh from input stream in obj file format.

Reads "v" (vertex) and "f" (face) entries only.

Parameters
isinput stream, to read from file use std::fstream
meshobject where the mesh is stored, if the given mesh is not empty, all contents are cleared
void walberla::geometry::readMeshOff ( std::istream &  is,
TriangleMesh mesh 
)

Reads mesh from input stream in Geomview Object File Format.

Reads "v" (vertex) and "f" (face) entries only. Only triangular faces are supported. Colors are currently also not supported. Format details: http://people.sc.fsu.edu/~jburkardt/data/off/off.html

Parameters
isinput stream, to read from file use std::fstream
meshobject where the mesh is stored, if the given mesh is not empty, all contents are cleared
void walberla::geometry::readMeshPov ( std::istream &  is,
TriangleMesh mesh,
bool  clear = true 
)

Reads mesh from input stream in povray's mesh2 format.

Vertices, normals and faces are read.

Parameters
isinput stream, to read from file use std::fstream
meshobject where the mesh is stored, if the given mesh is not empty, all contents are cleared
void walberla::geometry::removeComments ( std::istream &  is,
std::ostream &  os 
)
template<typename BoundaryHandling >
void walberla::geometry::setNonBoundaryCellsToDomain ( StructuredBlockStorage &  blocks,
BlockDataID  boundaryHandlingId 
)
template<typename FlagField_T >
void walberla::geometry::setNonBoundaryCellsToDomain ( StructuredBlockStorage &  blocks,
BlockDataID  flagFieldID,
field::FlagUID  fluidFlagID 
)
static void walberla::geometry::skipComments ( std::istream &  is)
static
Sphere walberla::geometry::sphereFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a Sphere.

Example block: Sphere{ midpoint <1,2,3>; radius 5; }

BodyLogicalAND< Sphere, AABB > walberla::geometry::sphereSliceFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a difference/union/...

of bodies.

CellAABB walberla::geometry::toCellAABB ( const CellInterval &  cellInterval)
inline

Converts a CellInterval to a CellAABB.

A CellAABB can not hold negative bounds and therefore not be empty. You have to check yourself if this is the case!

Parameters
cellIntervalThe CellInterval to be converted.
Precondition
!cellInterval.empty()
cellInterval.positiveIndicesOnly()
Returns
The CellAABB.
Torus walberla::geometry::torusFromConfig ( const Config::BlockHandle &  block)

Parses a configuration block and returns a Torus.

Example block: Torus{ midpoint <1,2,3>; normal <1,0,0>; radius 5; distance 1; }

void walberla::geometry::validateCellInterval ( const CellInterval &  cellInterval)
inline

Validate if the given CellInterval can be converted to a CellAABB.

Logs an Error and aborts if either cellInterval.empty() or !cellInterval.positiveIndicesOnly() since a CellAABB can neither be empty nor contain negative bounds.

Parameters
cellIntervalThe validated CellInterval.
void walberla::geometry::writeMesh ( const std::string &  meshFilename,
const TriangleMesh mesh 
)

writes a mesh to file

Mesh format is detected by file ending.

Parameters
fileNameFilename of mesh. Supported formats are obj, pov and off. Format is detected by file ending
meshobject where the mesh is read from
void walberla::geometry::writeMeshObj ( std::ostream &  os,
const TriangleMesh mesh 
)

Writes mesh to output stream in obj format.

Writes obj file with vertex, normal and face information

Parameters
osthe output stream. To write to file call with ofstream("filename.obj"))
meshthe mesh to write
void walberla::geometry::writeMeshOff ( std::ostream &  os,
const TriangleMesh mesh 
)

Writes a mesh to an output stream in Geomview Object File Format.

Writes vertices and faces only. Colors are not (yet) supported. Format details: http://people.sc.fsu.edu/~jburkardt/data/off/off.html

Parameters
osthe output stream. To write to file call with ofstream("filename.off")
meshthe mesh to write
void walberla::geometry::writeMeshOnRoot ( const std::string &  meshFilename,
const TriangleMesh mesh 
)

writes a mesh to file on root process

Mesh format is detected by file ending.

Parameters
fileNameFilename of mesh. Supported formats are obj, pov and off. Format is detected by file ending
meshobject where the mesh is read from
void walberla::geometry::writeMeshPov ( std::ostream &  os,
const TriangleMesh mesh,
size_t  itemsPerLine = 5u,
size_t  itemsPerMesh = 0u 
)

Writes mesh in povray's mesh2 format.

Vertices, normals and faces are written.

Parameters
osthe output stream. To write to file call with ofstream("filename.dat")
meshthe mesh to write
void walberla::geometry::writeMeshPov0 ( std::ostream &  os,
const TriangleMesh mesh,
const size_t  itemsPerLine 
)
void walberla::geometry::writeMeshVtp ( std::ostream &  os,
const TriangleMesh mesh 
)

Writes a mesh to an output stream in VTK Poly Data format.

Writes colors and vertex normals if available Format details: http://www.vtk.org/VTK/img/file-formats.pdf

Parameters
osthe output stream. To write to file call with ofstream("filename.vtp")
meshthe mesh to write