Electromagnetic Template Library (EMTL)
Loading...
Searching...
No Matches
emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList > Class Template Reference

Template class alowing to fill space region with mesh blocks of up to 2 different types Work with the object of this class assumes 3 stages: More...

#include <mesh.h>

Inheritance diagram for emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >:
Collaboration diagram for emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >:

Public Types

enum  rank_flags
 Describe how to treat points out of container.
 
using interp_arg_t = typename interp_def_t::interp_arg_t
 interpolation argument for container: includes position and field types
 
using interp_form_t = typename interp_def_t::interp_form_t
 aggregate interpolation type for container
 
using interp_transfer_t = typename interp_def_t::interp_transfer_t
 class for managing interpolation transfers between domains
 

Public Member Functions

int test_rank (Vector_3 &pos, int flag=CONTTEST, int *modified=nullptr) const
 Returns the rank of rank region where the point belongs.
 
int test_level (const int lev, const Vector_3 &pos) const
 Tests if some point is covered by mesh with higher level than a given level lev.
 
template<int measure_space = 0, class interp_arg_tt >
interp_arg_tt::interp_form_t create_interpolation (const interp_arg_tt &arg, std::vector< interp_arg_tt > *nonlocal=nullptr, bool all_nonlocal=false)
 Creates aggregate interpolation coefficient (as in emMeshBlock).
 
template<int measure_space = 0, class interp_arg_tt , class reg_tester_t >
interp_arg_tt::interp_form_t create_reg_interpolation (const interp_arg_tt &arg, reg_tester_t *rtester=nullptr, std::vector< interp_arg_tt > *nonlocal=NULL, bool all_nonlocal=false)
 Creates aggregate interpolation with region test if rtester is not null

 
template<class interp_form_tt >
emtype get_interp_value (const interp_form_tt *entry)
 Gets interpolated value (as in emMeshBlock).
 
template<int Dir = 0, class interp_form_tt >
std::pair< size_t, size_t > fill_interp_value_async (const interp_form_tt *entry, int depth, int action, emtype *buff, emtype *buff_vec)
 Fills interpolated value into a pointer using a block that is found for this interpolation.
 
emtype get_interp_value_async (const interp_form_t *entry, int depth)
 Gets interpolated value (as in emMeshBlock).
 
template<class interp_packer_tt >
void remap_async_interpolation (interp_packer_tt &entry) const
 Remaps with registered buffer lookup map.
 
int decode_interpolation (const interp_form_t *entry, std::vector< indtype > &vind, std::vector< emtype > &vcoeff)
 Decodes interpolation: puts data indicies and corresponding coefficients into vectors.
 
template<class interp_arg_tt >
int test_local (const interp_arg_tt &arg)
 Returns 1 if argument is within current domain.
 
Vector_3 get_position (int ind, int &ftype, Vector_3 &fdir) const
 Gives space position of given memory index.
 
virtual const Region_3 * GetRankRegion (int rank) const
 Gets the control region of the MPI rank. The regions do not overlap.
 
virtual const Region_3 * GetExtRankRegion (int rank) const
 Gets the extended control region of the MPI rank, including halos. The regions may overlap over halos.
 
void SetBalancedDecomposition (int balanced_=1, const Vector_3 &balanced_dx_=0, const method_load_t &load_=method_load_t())
 Perform balanced domain decomposition.
 
int AddRankRegion (int rank, mngarg< Region_3 > extreg)
 Adds a region processed by processor with given rank.
 
template<int blocktype_id>
int AddBlock (mngarg< typename BlocksTypes::template Get< blocktype_id > > ptr, int lev=0)
 Add block of type blocktype_id. The block pointer will be deleted by emBlockContainer if mngarg.manged is set to 1.
 
int GetHaloStage () const
 Describes which type of halo to use.
 
void ClearMesh ()
 Resets all mesh fields to zero.
 
void RemoveMesh ()
 Removes all allocated mesh data.
 
int PrepareExplicitGlobal (valtype dt)
 Prepares the container for explicit timestepping (global phase).
 
int PrepareExplicitLocal (valtype dt)
 Prepares the container for explicit timestepping (local phase).
 
int PrepareExplicit (valtype dt)
 Prepares the container for explicit timestepping (global + local).
 
template<int blocktype_id, typename ContourFixType , typename ... Args>
bool init_fix (int blockid, Args &&... args)
 We may use it later.
 
template<int blocktype_id, typename local_fix_stack_t , typename ContourFixType , typename ... Args>
bool append_fix_data (int blockid, contour_table_t &table, local_fix_stack_t &ldl, Args &&... args)
 Appends fix data found for a cell to local fix data list specified in the contour table.

 
int GetSyncSteps () const
 
int GetSyncHalfSteps () const
 
int GetFirstUpdField () const
 
ptrdiff_t register_async_location (indtype ind, indtype bufind)
 Forced bufind, if nonnegative is recorded as buffer index, otherwise next count is used.
 
virtual int SetTimeProfile (time_profile_t *time_profilep, int managed=0)
 Set global time profile for delayed boundary. Default is flat profile;.
 
virtual time_profile_tGetTimeProfile () const
 Get global time profile for delayed boundary.
 
int SetCntAnalysisFlags (int flags=~0)
 switch contour analysis modes
 
- Public Member Functions inherited from emComponent
emDump * GetEmDumper ()
 This function insures that the returned dumper is of true emDumper type.
 

Protected Member Functions

template<class bdescr_t >
int prepare_weight_grid (const std::vector< bdescr_t * > &_blocks, UniformGrid< vec_type > &grid)
 Prepare grid with load data.
 
int prepare_weight_grid (UniformGrid< vec_type > &grid)
 Prepare grid with load data.
 
template<int blocktype_id>
size_t analyze_geometry ()
 Determines used/unused contours for local rank regions.
 
virtual size_t analyze_geometry ()
 Call analyze_geometry for all blocks.
 
template<int blocktype_id>
int analyze_contours ()
 Specify coefficients in mesh update discretized equations and possible fixes (PML, TF/SF, etc.), old version.
 
template<int blocktype_id>
int analyze_contours_methods ()
 Fills in coefficients in mesh update discretized equations and possible fixes (PML, TF/SF, etc.), method version.
 
virtual int ProcessOutsidePoint (Vector_3 &pos, int &field, Vector_3 &dir) const
 This function is called to process contours outside the main region.
 
std::tuple< int, int, int > test_in_all_blocks (int testlev, const Vector_3 &pos) const
 Test if a point is covered by mesh with level higher than a given one.
 

Static Protected Member Functions

template<typename bdescr_vector_t >
static int test_in_blocks (int tstlev, const bdescr_vector_t &_blocks, const Vector_3 &pos, int &index)
 Records index of block with maximal level which contains point pos and returns its level.
 

Protected Attributes

size_t sz
 main (aligned) data pointer

 
interp_transfer_packer_t * trans_seq
 transfer packer for methods

 
mngptr< reg_t > region
 index vectors for interpolation

 
BdescrVectors blocks
 region for the container

 
iVector_3 ndomains
 arguments of MakeBoxContainerDomain

 
int balanced
 perform balanced domain decomposition

 
int balanced_ppn
 if more than 1, then number of processors in subdomain

 
int ppn_weight
 perform balanced decomposition for superdomains

 
Vector_3 balanced_dx
 space step used in grid for domain domain decomposition

 
method_load_t load
 load coefficients for different methods

 
UniformGrid< vec_type > weight_grid
 auxilliary grid used for balanced domain decomposition

 
refvector< RankRegionrank_regions
 rank regions

 
int analytic_geometry_analysis
 Do geometrical analysis analitiaclly, without contours loop.
 
int halo_stage = 0
 stage of asynchronous halo movement: 0= advance, 1= retreat
 
struct emBlockContainer::tid_t tid
 timers numbers
 
int analyze_flags = ~0
 flags for order and presence of certain mesh analysis functions: 0xffff= full analysis, 0x1 = call analyze_contours
 
std::map< ptrdiff_t, ptrdiff_t > buffer_lookup
 Map between mesh index needing asynchronous storage and buffer index.

 
mngptr< time_profile_ttime_profile
 Time profile object that determines time shift depending on location.
 

Static Protected Attributes

static int idcount
 block id counter
 
static size_t indcount
 block size counter

 

Detailed Description

template<class reg_t, class contour_table_tt, class fix_stack_tt, template< class cont_ttt > class interp_def_tt, class BlocksList>
class emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >

Template class alowing to fill space region with mesh blocks of up to 2 different types Work with the object of this class assumes 3 stages:

  1. Specifying the calculated volume (SetRegion), adding meshes (AddBlock1, AddBlock2)
  2. Preparation of the object to future simulation (PrepareExplicit) At this stage all internal objects are initialized and required memory is allocated
  3. Update meshes with given time step (Step) One can come back from current stage to the previous one using function RemoveMesh

Field from given point at the calculated volume is returned using getField Interpolation form emInterpolation used in different EMTL classes (e.g.., emInterpTransfer) is returned using create_interpolation.

Member Function Documentation

◆ analyze_contours_methods()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
template<int blocktype_id>
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::analyze_contours_methods ( )
protected

Fills in coefficients in mesh update discretized equations and possible fixes (PML, TF/SF, etc.), method version.


◆ analyze_geometry()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
virtual size_t emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::analyze_geometry ( )
inlineprotectedvirtual

Call analyze_geometry for all blocks.

Returns
Number of initialized contours

◆ create_interpolation()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
template<int measure_space = 0, class interp_arg_tt >
interp_arg_tt::interp_form_t emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::create_interpolation ( const interp_arg_tt &  arg,
std::vector< interp_arg_tt > *  nonlocal = nullptr,
bool  all_nonlocal = false 
)

Creates aggregate interpolation coefficient (as in emMeshBlock).

Adds non-local (unresolved) requests to nonlocal (if it is not nullptr).

◆ GetFirstUpdField()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::GetFirstUpdField ( ) const
inline
Returns
the first field to be updated by bulk update, 0= E, 1=H

◆ GetSyncHalfSteps()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::GetSyncHalfSteps ( ) const
inline
Returns
the number of FDTD half steps required to reach synchronization level

◆ GetSyncSteps()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::GetSyncSteps ( ) const
inline
Returns
the number of FDTD full steps (2 fields together) required to reach synchronization level.

◆ init_fix()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
template<int blocktype_id, typename ContourFixType , typename ... Args>
bool emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::init_fix ( int  blockid,
Args &&...  args 
)
inline

We may use it later.

Initialize ContourFixType in corresponding fix_stack. It doesn't write a thing into fix storage.

◆ prepare_weight_grid() [1/2]

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
template<class bdescr_t >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::prepare_weight_grid ( const std::vector< bdescr_t * > &  _blocks,
UniformGrid< vec_type > &  grid 
)
protected

Prepare grid with load data.

This grid will be used for balanced domain decomposition.

◆ prepare_weight_grid() [2/2]

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::prepare_weight_grid ( UniformGrid< vec_type > &  grid)
protected

Prepare grid with load data.

This grid will be used for balanced domain decomposition. This version works faster, since amount of grid points 6 times smaller than number of contours.

◆ test_in_all_blocks()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
std::tuple< int, int, int > emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::test_in_all_blocks ( int  testlev,
const Vector_3 &  pos 
) const
protected

Test if a point is covered by mesh with level higher than a given one.

The test is performed for all blocks. It returns level, index in vector, and blocktype_id for highest level found.

Parameters
testlevminimal accepted level
pospoint absolute position
Returns
tuple<int, int, int>(level, block_id, blocktype_id)

◆ test_in_blocks()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
template<typename bdescr_vector_t >
static int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::test_in_blocks ( int  tstlev,
const bdescr_vector_t &  _blocks,
const Vector_3 &  pos,
int &  index 
)
staticprotected

Records index of block with maximal level which contains point pos and returns its level.

this level should be not smaller than tstlev.

◆ test_rank()

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::test_rank ( Vector_3 &  pos,
int  flag = CONTTEST,
int *  modified = nullptr 
) const

Returns the rank of rank region where the point belongs.

Parameters
flagMODIFY – modify argument according to container boundary conditions CONT – test container, first test ranks then container CONTFIRST – first test container then ranks when not nullptr modified is set to 1 if the pos is modified.

Member Data Documentation

◆ analytic_geometry_analysis

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
int emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::analytic_geometry_analysis
protected

Do geometrical analysis analitiaclly, without contours loop.

Works only for box domain decomposition (MPI).

◆ blocks

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
BdescrVectors emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::blocks
protected

region for the container

lists of blocks of different types

◆ sz

template<class reg_t , class contour_table_tt , class fix_stack_tt , template< class cont_ttt > class interp_def_tt, class BlocksList >
size_t emBlockContainer< reg_t, contour_table_tt, fix_stack_tt, interp_def_tt, BlocksList >::sz
protected

main (aligned) data pointer

data size


The documentation for this class was generated from the following file: