ivutils
|
Template function definitions for region.h. More...
Functions | |
template<int N, class contour_t > | |
vec_type | MonteCarloTestContour (const Region< N > *reg, const contour_t &cnt, Vector_Nt< vec_type, N > *subcenter, int nt) |
Returns the area fraction of the contour part that is inside the region reg, subcontour which is inside the region (if pointer is not nullptr) and the center of the subcontour (if pointer is not nullptr) by Monte Carlo method. | |
template<int N> | |
int | MonteCarloTestLine (const Region< N > *reg, const Vector_Nt< vec_type, N > &p, const Vector_Nt< vec_type, N > &dir, vec_type *frac, Vector_Nt< vec_type, N > *surfp, Vector_Nt< vec_type, N > *surfn, vec_type length, int nt) |
Records the fractions frac1 and frac2 of the interval (p,p+dir*length/dir.norm()) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal. | |
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) |
Domain decomposition of the Box, abs(nproc) is number of domains. | |
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. | |
Template function definitions for region.h.
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.
vec_type MonteCarloTestContour | ( | const Region< N > * | reg, |
const contour_t & | cnt, | ||
Vector_Nt< vec_type, N > * | subcenter = nullptr , |
||
int | nt = 1000 |
||
) |
Returns the area fraction of the contour part that is inside the region reg, subcontour which is inside the region (if pointer is not nullptr) and the center of the subcontour (if pointer is not nullptr) by Monte Carlo method.
nt is number of random points used in Monte Carlo method.
int MonteCarloTestLine | ( | const Region< N > * | reg, |
const Vector_Nt< vec_type, N > & | p, | ||
const Vector_Nt< vec_type, N > & | dir, | ||
vec_type * | frac, | ||
Vector_Nt< vec_type, N > * | surfp, | ||
Vector_Nt< vec_type, N > * | surfn, | ||
vec_type | length, | ||
int | nt = 1000 |
||
) |
Records the fractions frac1 and frac2 of the interval (p,p+dir*length/dir.norm()) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal.
returns the number of intersections: 0, 1 or 2 (if there are more than 2 intersections, skip them). in calculations nt points at the interval (p, p+length*dir/dir.norm()) are checked if they are inside or outside the region