Medusa  1.1
Coordinate Free Mehless Method implementation
Domains

Defines various shapes and domain discretization procedures. More...

Classes

class  mm::BallShape< vec_t >
 Class for working with ball shaped domains. More...
 
class  mm::BasicRelax
 Redistributes nodes towards more uniform distribution by minimizing potential between nodes. More...
 
class  mm::BoxShape< vec_t >
 Class for working with box shaped domains. More...
 
struct  mm::discretization_helpers::SphereDiscretization< scalar_t, dim >
 Discretizes a sphere with given radius uniformly with num_points points on the great circle. More...
 
class  mm::DomainDiscretization< vec_t >
 Class representing domain discretization along with an associated shape. More...
 
class  mm::DomainShape< vec_t >
 Base class for geometric shapes of domains. More...
 
class  mm::FindBalancedSupport
 Class representing the engine for finding directionally balanced supports. More...
 
class  mm::FindClosest
 Class representing the engine for finding supports consisting of closest nodes. More...
 
class  mm::GeneralFill< vec_t >
 Implements general n-d node placing algorithm, as described in https://arxiv.org/abs/1812.03160 If you specifically use this algorithm, we would appreciate if you cite the above publication. More...
 
class  mm::GeneralSurfaceFill< vec_t, param_vec_t >
 Implements general n-d node placing algorithm for parametrically given d-d surfaces, as described in https://arxiv.org/abs/2005.08767. More...
 
class  mm::GrainDropFill< vec_t >
 Implements general n-d node placing algorithm, as described in https://arxiv.org/abs/1906.00636 This node generation algorithm simulates dropping grains with variable radius in a box. More...
 
class  mm::GridFill< vec_t >
 Discretizes the domain using n-dimensional grid with given endpoints and spacing h. More...
 
class  mm::HalfLinksRefine
 Refine a region of nodes region by connecting every node in region to its support domain and generating new nodes at half distances. More...
 
class  mm::NURBSPatch< vec_t, param_vec_t >
 Class representing a single NURBS patch in an arbitrary dimensional space, defined on an arbitrary dimensional domain and generated by a tensor product of NURBS curves. More...
 
class  mm::NURBSShape< vec_t, param_vec_t >
 Class representing a shape made out of NURBS patches in an arbitrary dimensional space. More...
 
class  mm::PolygonShape< vec_t >
 Shape representing a simple (i.e. non self intersecting) nonempty polygon in 2D, which is given as a sequence of points. More...
 
class  mm::PolyhedronShape< vec_t >
 A polyhedron represented by a closed triangular mesh. More...
 
class  mm::PolytopeShape< vec_t >
 Shape representing a simple nonempty polytope (i.e., non-self intersecting polygon in 2D and polyhedron in 3D.). More...
 
class  mm::RotatedShape< vec_t >
 Class for working with rotated (or mirrored) domain shapes. More...
 
class  mm::ShapeDifference< vec_t >
 A class representing a set-difference of two shapes. More...
 
class  mm::ShapeUnion< vec_t >
 Class representing a union of two shapes. More...
 
class  mm::STLShape< vec_t >
 Class representing an object given by the STL file. More...
 
class  mm::TranslatedShape< vec_t >
 Class for working with translated domain shapes. More...
 
class  mm::UnknownShape< vec_t >
 This class represents an unknown domain shape. More...
 

Functions

template<typename scalar_t , int dim_from, int dim_to>
Vec< scalar_t, dim_to > mm::surface_fill_internal::compute_normal (Eigen::Matrix< scalar_t, dim_to, dim_from > J)
 Compute normal from given Jacobian. More...
 
template<typename vec_t , typename func_t >
Range< vec_t > mm::discretization_helpers::discretizeLineWithDensity (const vec_t &p, const vec_t &q, const func_t &delta_r)
 Returns nodes lying on the line segment pq with approximate distances delta_r. More...
 
template<typename vec_t , typename func_t >
Range< vec_t > mm::discretization_helpers::discretizeTriangleWithDensity (const vec_t &p1, const vec_t &p2, const vec_t &p3, const vec_t &normal, const func_t &h, bool only_interior=true)
 Discretize a triangle in 3D space with given density. More...
 

Detailed Description

Defines various shapes and domain discretization procedures.

We separated the computation domain into two parts, its analytical description, which is called DomainShape and its discretization, called DomainDiscretization.

Some basic domain shapes are added, as well as support for set-theoretic operations between them. They are usually dimension independent and can be assembled into decently complex structures for demonstration purposes.

Support for 3D polytopes and proper CAD designs is intended. Additionally, we can import discretizations from HDF5 files.

Once domain shape has been constructed, it can be discretized. Domain discretization contains nodes, their types and normals for boundary nodes. Types are positive for internal nodes and negative for boundary nodes.

Domain discretizations can also be constructed using fill engines, improved via iterative methods and refined. Some stencil selection algorithms are supported as well.

Function Documentation

◆ compute_normal()

template<typename scalar_t , int dim_from, int dim_to>
Vec<scalar_t, dim_to> mm::surface_fill_internal::compute_normal ( Eigen::Matrix< scalar_t, dim_to, dim_from >  J)

Compute normal from given Jacobian.

Template Parameters
scalar_tNumeric scalar type, e.g. double or float.
dim_fromParametric domain dimension.
dim_toTarget domain dimension.
Parameters
Jdim_to x dim_from Jacobi matrix, which must have full rank.
Returns
A unit vector n, such that it is orthogonal to all columns of J and that the determinant of [J n] is negative. This corresponds to the right-hand side 90 deg rotation in 2d and the negative cross product in 3d. If dim_to == dim_from+1 this uniquely defines the normal.

Examples
test/domains/compute_normal_test.cpp.

◆ discretizeLineWithDensity()

template<typename vec_t , typename func_t >
Range<vec_t> mm::discretization_helpers::discretizeLineWithDensity ( const vec_t &  p,
const vec_t &  q,
const func_t &  delta_r 
)

Returns nodes lying on the line segment pq with approximate distances delta_r.

Boundary point are not included in return set, but are included in the spacing. The last discretization point almost never falls on point q, but before it, and we decide on whether to include it or not, based on whether spacing at q is more violated with including the point or without.

Returns
Discretization points spaced according to the delta_r with last and first point (i.e. p and q) excluded.
Vec2d p = 0.0, q = {1.0, 0.5};
auto fn = [](const Vec2d& p) { return 0.1*(1+p[0]); };
Examples
test/domains/discretization_helpers_test.cpp.

Definition at line 35 of file discretization_helpers.hpp.

◆ discretizeTriangleWithDensity()

template<typename vec_t , typename func_t >
Range<vec_t> mm::discretization_helpers::discretizeTriangleWithDensity ( const vec_t &  p1,
const vec_t &  p2,
const vec_t &  p3,
const vec_t &  normal,
const func_t &  h,
bool  only_interior = true 
)

Discretize a triangle in 3D space with given density.

The orientation of the triangle is not important. The triangle is discretized by first discretizing the boundary and filling the interior with a GeneralFill.

Template Parameters
vec_tMust be a three-dimensional vector type.
Parameters
p1First point.
p2Second point.
p3Third point.
normalUnit normal vector of the plane defined by the triangle.
hSpacing function.
only_interiorIf true, only the points in the interior are returned, otherwise, boundary discretization points are returned as well.
Returns
A list of discretization points in the triangle.
Vec3d p1 = {0, 0, 1}, p2 = {0, 1, 0}, p3 = {1, 0, 0};
Vec3d n = (p2-p1).cross(p3-p1).normalized();
auto fn = [](const Vec3d&) { return 0.3; };
std::vector<Vec3d> pts_with_bnd = discretization_helpers::discretizeTriangleWithDensity(
p1, p2, p3, n, fn, false); // include boundary nodes
std::vector<Vec3d> pts_only_int = discretization_helpers::discretizeTriangleWithDensity(
p1, p2, p3, n, fn, true);
See also
GeneralFill, PolygonShape, STLShape
Examples
test/domains/discretization_helpers_advanced_test.cpp.

Definition at line 45 of file discretization_helpers_advanced.hpp.

mm::discretization_helpers::discretizeTriangleWithDensity
Range< vec_t > discretizeTriangleWithDensity(const vec_t &p1, const vec_t &p2, const vec_t &p3, const vec_t &normal, const func_t &h, bool only_interior=true)
Discretize a triangle in 3D space with given density.
Definition: discretization_helpers_advanced.hpp:45
mm::Vec3d
Vec< double, 3 > Vec3d
Convenience typedef for 3d vector of doubles.
Definition: Vec_fwd.hpp:35
mm::discretization_helpers::discretizeLineWithDensity
Range< vec_t > discretizeLineWithDensity(const vec_t &p, const vec_t &q, const func_t &delta_r)
Returns nodes lying on the line segment pq with approximate distances delta_r.
Definition: discretization_helpers.hpp:35
mm::Vec2d
Vec< double, 2 > Vec2d
Convenience typedef for 2d vector of doubles.
Definition: Vec_fwd.hpp:34