ivutils
|
A collection of objects for various 3D bodies. More...
Classes | |
class | Box |
orthogonal box, see documentation to Box_N More... | |
class | Polyhedron< plane_itt > |
polyhedron defined as a set of planes More... | |
class | Polyhedron_3 |
polyhedron as array of planes More... | |
class | Sphere |
3D sphere More... | |
class | Cylinder< base_tt > |
Cylinder with arbitrary 2D base of the type base_t Cylinder axis passes the point origin and directed along vector n Axes of 2D plane which contain the base are directed along vector x and y Base is specified in 2D coordinate system defined by origin, x and y Vector n is perpendicular to x and y (cylinder axis is perpendicular to the base) "Tilted" cylinder with axis not perpendicular to the base can be specified using template StretchedRegion. More... | |
class | Cone< base_tt > |
Cone with arbitrary 2D base of the type base_tt Cone axis passes the point origin and directed along vector n Axes of 2D plane which contain the base are directed along vector x and y Base is specified in 2D coordinate system defined by origin, x and y Vector n is perpendicular to x and y (cone axis is perpendicular to the base) Top of the cone is origin+L*n "Tilted" cone with axis not perpendicular to the base can be specified using template StretchedRegion. More... | |
class | ConfinedRegion< reg_tt > |
Intersection of polyhedron with arbitrary other region. More... | |
class | Inverse< reg_tt > |
Complement to the region in 3D space. More... | |
class | volume_integral_const_t |
Volume integral of constant space density. More... | |
class | transition< reg_t > |
function that continuosly changes from 0 to 1 near surface of region reg (used to specify alloys in Microvolt) More... | |
Functions | |
size_t | FaceRefine (const Polyhedron_3 &poly, std::vector< int > *valid_planes=nullptr) |
Finds valid planes within the Polyhedron_3 by constructing its all faces and puts the indicies of the valid planes into valid_planes, if specified. | |
Polyhedron_3 * | GetHalfSpace (const Vector_3 &n, const Vector_3 &pos) |
returns "polyhedron" formed by one plane (half-space) | |
Polyhedron_3 * | GetPlate (const Vector_3 &n, const Vector_3 &pos, vec_type width) |
returns "polyhedron", formed by 2 parallel planes (infinite plane) | |
Polyhedron_3 * | GetBox (const Vector_3 &p1, const Vector_3 &p2) |
returns polyhedron - regular parallelipiped | |
Polyhedron_3 * | GetPrism (const Vector_3 &O, const Vector_3 &top, const Vector_3 &x, const Vector_3 &y, Polygon_2 *base, bool confinement=false) |
returns polyhedron - prism O is center of the polygon in the base, top is the translation of O in the prism direction, x and y are axis directions, the polygon will be created relatively to these axis, base is polygon, if confinment is true, adds a planes that confine the pprism (if absent then the prism is infinite in all directions) | |
Polyhedron_3 * | GetPyramid (const Vector_3 &O, const Vector_3 &top, const Vector_3 &x, const Vector_3 &y, Polygon_2 *base, bool confinement=false) |
returns polyhedron - pyramid O is center of the polygon in the base, top is top of the pyramid, x and y are axis directions, polygon will be created relatively to these axis, base is polygon , if confinment is true, adds a plane which confines pyramid (if it is absent then pyramid is infinite in one direction) | |
Polyhedron_3 * | GetConfinedPolyhedron (mngarg< Polyhedron_3 > c1, mngarg< Polyhedron_3 > c2) |
returns polyhedron which is intersection of two other polyhedra | |
template<class reg_t > | |
ConfinedRegion< reg_t > * | GetConfinedRegion (mngarg< reg_t > c1, mngarg< Polyhedron_3 > c2) |
returns region which is intersection of some other region and polyhedron | |
Sphere * | GetSphere (vec_type R, const Vector_3 ¢er) |
returns sphere of the radius R centered in the point center | |
Plane_3 * | CreateSpherePlanes (const int &N, const vec_type &R, const Vector_3 ¢er) |
returns polyhedron for N sides which approximating sphere | |
Cylinder< Circle > * | GetCylinder (const Vector_3 &origin, Vector_3 n, vec_type R) |
returns cylinder, origin is some point at cylinder axis, n is axis direction, R is radius | |
ConfinedRegion< Cylinder< Circle > > * | GetCylinder (const Vector_3 &origin, Vector_3 n, vec_type R, vec_type height) |
height is height of finite cylinder, height is measured from origin in direction n | |
ConfinedRegion< Cone< Circle > > * | GetCone (const Vector_3 &origin, Vector_3 n, vec_type R, vec_type h, Vector_3 npl=Vector_3(0)) |
height is height of cone, height is measured from origin in direction n | |
ConfinedRegion< Cone< Circle > > * | GetTruncatedCone (const Vector_3 &origin, Vector_3 n, vec_type R, vec_type R_top, vec_type h) |
R_top is upper radius (if R_top=0, then function works in a same way as GetCone) | |
template<class inp_it , class weight_integral_t > | |
int | MakeBoxDomains (const Box &box, int nproc, int nx, int ny, int nz, inp_it result, const weight_integral_t &weight_integral, const Vector_3 &dx=0) |
Domain decomposition of the Box, abs(nproc) is number of domains. | |
template<class point_it > | |
Vector_3 | get_min_point (const Vector_3 &k, point_it beg, point_it end) |
gets the point having minimal projection on the direction k infinite vectors are ignored returns an infinite vector for void sequence | |
template<int N> | |
int | build_orth_basis (Vector_Nt< vec_type, N > *in, int innum, Vector_Nt< vec_type, N > *out) |
in are some orthogonal vectors, innum is their number, out are 3-innum vectors of the unit length which are orthogonal to all vectors in and to each other. | |
template<int N> | |
int | build_orth_basis (const Vector_Nt< vec_type, N > &z, Vector_Nt< vec_type, N > &x, Vector_Nt< vec_type, N > &y) |
calculates 2 unit vectors x, y perpeindicular to unit vector z. | |
Vector_3 | random_direction () |
get arbitrary unit vector in 3D | |
Vector_3 | randdir () |
returns random unit vector uniformely distributed in 3D space (uses standard rand()) | |
Vector_2 | randdir2 () |
returns random unit vector uniformely distributed in 2D space (uses standard rand()) | |
bool | get_first_corner (const Box &box, const Plane_3 &plane, const Vector_3 &k, Vector_3 *start) |
calculates the intersection contour of the plane with the box, returns true if the intersection is nonvoid *start is updated with the contour point having minimal projection on k direction | |
bool | get_first_corner (const Box &box, const Vector_3 &k, Vector_3 *start) |
*start is updated with the box point having minimal projection on k direction | |
bool | find_cross_segment (const Region_3 ®, const Vector_3 &orig, const Vector_3 &dir, vec_type &t1, vec_type &t2) |
Find the intersection of a convex region with the line l(t)=origin+dir*t. | |
int | fill_lattice (const Region_3 ®, const Vector_3 &orig, const Basis_3 &cell, std::vector< Vector_3 > &points, std::vector< iVector_3 > *ipoints=NULL) |
Fills the space inside convex region by the lattice given by 3 elementary translations (cell) starting from origin (orig). | |
Vector_3 * | make_reciprocal_vectors (const vec_type a1, const vec_type a2, const vec_type max, int &num) |
until Basis_Nt and calculating inverse matrix are not implemented, works only for 2D rectangular case | |
template<class contour_t > | |
vec_type | GetContourFraction (const Region_3 *reg, const contour_t &cnt, int volume_step, vec_type a0, const Vector_3 ¢er, const Vector_3 &dir, VecContour<> *subcont, Vector_3 *normv) |
gets area fraction of the contour (if volume_step=0) or volume fraction of the control volume around contour (if volume_step>0), which is entering the region reg subcontour inside the region is recorded to subcont (if subcont!=NULL) normal to the region (in proximity to contour intersection with region) is recorded to normv (if norm!=NULL) if volume_step>0, calculate fraction of the control volume, considering area fractions of 2*volume_step+1 copies of the contour in this volume This function can be used, for example, to calculate averaged dielectric function in FDTD subpixel smoothing, see A. | |
A collection of objects for various 3D bodies.
int build_orth_basis | ( | const Vector_Nt< vec_type, N > & | z, |
Vector_Nt< vec_type, N > & | x, | ||
Vector_Nt< vec_type, N > & | y | ||
) |
calculates 2 unit vectors x, y perpeindicular to unit vector z.
Works correctly for N=3 only.
int build_orth_basis | ( | Vector_Nt< vec_type, N > * | in, |
int | innum, | ||
Vector_Nt< vec_type, N > * | out | ||
) |
in are some orthogonal vectors, innum is their number, out are 3-innum vectors of the unit length which are orthogonal to all vectors in and to each other.
Works correctly for N=3 only.
|
inline |
Finds valid planes within the Polyhedron_3 by constructing its all faces and puts the indicies of the valid planes into valid_planes, if specified.
int fill_lattice | ( | const Region_3 & | reg, |
const Vector_3 & | orig, | ||
const Basis_3 & | cell, | ||
std::vector< Vector_3 > & | points, | ||
std::vector< iVector_3 > * | ipoints = NULL |
||
) |
Fills the space inside convex region by the lattice given by 3 elementary translations (cell) starting from origin (orig).
Puts the filled positions into points by push_back operation (no clearing is performed). Optionally (if ipoints is not NULL) fills integer lattice indices indicating the translation numbers for each point.
bool find_cross_segment | ( | const Region_3 & | reg, |
const Vector_3 & | orig, | ||
const Vector_3 & | dir, | ||
vec_type & | t1, | ||
vec_type & | t2 | ||
) |
Find the intersection of a convex region with the line l(t)=origin+dir*t.
*start is updated with the box point having minimal projection on k direction
vec_type GetContourFraction | ( | const Region_3 * | reg, |
const contour_t & | cnt, | ||
int | volume_step, | ||
vec_type | a0, | ||
const Vector_3 & | center, | ||
const Vector_3 & | dir, | ||
VecContour<> * | subcont, | ||
Vector_3 * | normv | ||
) |
gets area fraction of the contour (if volume_step=0) or volume fraction of the control volume around contour (if volume_step>0), which is entering the region reg subcontour inside the region is recorded to subcont (if subcont!=NULL) normal to the region (in proximity to contour intersection with region) is recorded to normv (if norm!=NULL) if volume_step>0, calculate fraction of the control volume, considering area fractions of 2*volume_step+1 copies of the contour in this volume This function can be used, for example, to calculate averaged dielectric function in FDTD subpixel smoothing, see A.
Deinega and I. Valuev, “Subpixel smoothing for conductive and dispersive media in the FDTD method”, Optics Letters 32, 3429 (2007)
a0 | contour area |
center | contour center |
dir | normal to the contour |
reg | region |
cnt | contour |
volume_step | if it is>0, makes 2*volume_step steps in different contour placements along the normal, the result is averaged |
subcont | подконтур, образуемый пересечением контура с регионом |
normv | вектор нормали к телу в районе пересечения им контура |
int MakeBoxDomains | ( | const Box & | box, |
int | nproc, | ||
int | nx, | ||
int | ny, | ||
int | nz, | ||
inp_it | result, | ||
const weight_integral_t & | weight_integral, | ||
const Vector_3 & | dx = 0 |
||
) |
Domain decomposition of the Box, abs(nproc) is number of domains.
nx, ny, nz - preferable number of sections per each dimension. This function is used in parallel implementation of numerical algorithms requiring spatial domain decomposition: each processor simulates a subBox (domain) of the whole Box. If any of the numbers is negative, then optimal number for the corresponding direction will be found. Resulting subdomains will be collected in result, if nproc>0.