RTOp Package Browser (Single Doxygen Collection) Version of the Day

#include "RTOp_ConfigDefs.hpp"
Go to the source code of this file.
Functions  
void  RTOp_parallel_calc_overlap (Teuchos_Ordinal global_dim, Teuchos_Ordinal local_sub_dim, Teuchos_Ordinal local_off, const Teuchos_Ordinal first_ele_off, const Teuchos_Ordinal sub_dim, const Teuchos_Ordinal global_off, Teuchos_Ordinal *overlap_first_local_ele_off, Teuchos_Ordinal *overalap_local_sub_dim, Teuchos_Ordinal *overlap_global_off) 
This function helps to implement vector method apply_op(...) for any type of parallel vector. 
void RTOp_parallel_calc_overlap  (  Teuchos_Ordinal  global_dim, 
Teuchos_Ordinal  local_sub_dim,  
Teuchos_Ordinal  local_off,  
const Teuchos_Ordinal  first_ele_off,  
const Teuchos_Ordinal  sub_dim,  
const Teuchos_Ordinal  global_off,  
Teuchos_Ordinal *  overlap_first_local_ele_off,  
Teuchos_Ordinal *  overalap_local_sub_dim,  
Teuchos_Ordinal *  overlap_global_off  
) 
This function helps to implement vector method apply_op(...)
for any type of parallel vector.
global_dim  [in] Dimension of the original parallel vector 'v' (see above). 
local_sub_dim  [in] Dimension of the local subvector 'u' (see above). 
local_off  [in] Gives the offset of the first element in the local subvector 'u' into the global vector 'v' (see above). 
first_ele_off  [in] Determines the first element in 'v' which is used to define the logical subvector 'g' (see above). 
sub_dim  [in] Determines the length of the logical subvector 'g' (see above). If sub_dim < 0 then sub_dim = global_dim  first_ele_off is used in its place. 
global_off  [in] Determines the offset of the logical subvector 'g' into the logical global vector 'p' (see above). 
overlap_first_local_ele_off  [out] If *overlap_first_local_ele < 0 on output, then this means that there is no overlap of 'u' with 'g' (see above). Otherwise, there is overlap and *overlap_first_local_ele_off gives the first element in 'u' that overlaps with 'g' which defines 'w' (see above). 
overlap_local_sub_dim  [out] If *overlap_first_local_ele_off < 0 on output then this argument is not set and should be ignored. Otherwise, *overlap_local_sub_dim gives number of elements in 'u' that overlaps with 'g' that defines 'w' (see above). 
overlap_global_off  [out] If *overlap_first_local_ele_off < 0 on output then this argument is not set and should be ignored. Otherwise, *overlap_global_off gives the placement of 'w' into 'p' (see above). 
Preconditions:
global_dim > 0
local_sub_dim > 0
0 <= local_off <= global_dim  local_sub_dim
1 <= first_ele_off <= global_dim
sub_dim > 0
] 0 < sub_dim <= global_dim  first_ele_off
0 <= global_off
Postconditions:
0 <= overlap_first_local_ele_off <= local_sub_dim
overlap_first_local_ele_off == 0
] There is no overlap of 'g' with 'u' overlap_first_local_ele_off != 0
] 0 <= overlap_local_sub_dim <= local_sub_dim  overlap_first_local_ele_off
To understand what this function computes first consider the what an apply_op(...)
method might look like from a vector class. This method would take a list of nonmutable vectors:
v_1, v_2, ..., v_p
and a list of mutable vectors
z_1, z_2, ..., z_q
and then apply the reduction/transformation operator op
over some subset of the elements in these vectors according to their placement as a set of subvectors in some other logical vector.
Let's consider how things are treated for a single vector argument v_i
or z_i
which we will call 'v'. This global vector 'v' is the first vector that we identity. One must understand that there are five distict vectors (or subvectors) being refered to here. The first vector (call it 'v') and is one of the parallel vectors that apply_op()
is called on that we have already discussed. The second vector (call it 'g') is the logical subvector that the client wants to represent using the elements in 'v'. This logical subvector is specified by the input arguments first_ele_off
, sub_dim
and global_off
. If for the time being we ignore global_off
, and then 'g' is defined in terms of 'v' as:
g(k) = v(first_ele_off+k), for k = 0...sub_dim1
However, for greater flexibility, the client can specify that the logical vector 'g' is really a subvector in a larger vector (a third vector, call it 'p') and can therefore specify where 'g' exists in 'p' using global_off
as:
p(k+global_off) = g(k) = v(first_ele_off+k), for k = 0...sub_dim1
In order to apply a reduction/transformation operator over the subvector 'g' in 'p' each process can only work with the elements of 'v' stored in the local process. Specifically, the local elements of 'v' stored in this process (the fourth vector, all it 'u') are:
u(k) = v(local_off+k), for k = 0...local_sub_dim1
The tricky part of implementing this function is is determining how much of 'u' overlaps with 'g' and then getting the offset into 'p' correct. If the local elements 'u' overlaps with 'g' then this defines the fifth subvector (call it 'w') that defines the overlap and is specified by the return arguments as:
w(k) = p(overlap_global_off+k) = u(overlap_first_local_ele_off+k), for k = 0...overalap_local_sub_dim1
Definition at line 50 of file RTOp_parallel_helpers.c.