16#ifndef Domaine_IJK_included
17#define Domaine_IJK_included
19#include <FixedVector.h>
21#include <TRUSTArrays.h>
23#include <Domaine_base.h>
25#include <IJK_Field_forward.h>
26#include <Domaine_forward.h>
30#include <Static_Int_Lists.h>
31#include <Faces_builder.h>
32#include <Probleme_base.h>
33#include <Interprete_bloc.h>
34#include <Linear_algebra_tools.h>
35#include <IJKArray_with_ghost.h>
36#include <Analyse_Angle.h>
37#include <Connectivite_som_elem.h>
48 Declare_instanciable_sans_constructeur(
Domaine_IJK);
66 assert(direction >= 0 && direction <= 2);
67 return faces[direction];
73 assert(direction >= 0 && direction <= 2);
74 return edges[direction];
84 bool perio_x,
bool perio_y,
bool perio_z);
101 int nproc_i,
int nproc_j,
int nproc_k,
102 int process_grouping_i = 1,
int process_grouping_j = 1,
103 int process_grouping_k = 1);
120 const ArrOfInt& slice_size_j,
121 const ArrOfInt& slice_size_k,
122 const IntTab& processor_mapping);
137 const ArrOfDouble& delta_x,
138 const ArrOfDouble& delta_y,
139 const ArrOfDouble& delta_z,
140 bool perio_x,
bool perio_y,
bool perio_z);
162 int offset_i,
int offset_j,
int offset_k,
163 const Nom& subregion,
164 bool perio_x =
false,
bool perio_y =
false,
bool perio_z =
false);
179 const ArrOfInt& slice_size_j,
180 const ArrOfInt& slice_size_k,
181 const IntTab& processor_mapping);
199 assert(direction >= 0 && direction < 3);
200 return nb_elem_local_[direction];
208 assert(nb_elem_local_[0] > 0);
209 assert(nb_elem_local_[1] > 0);
210 assert(nb_elem_local_[2] > 0);
211 return nb_elem_local_[0] * nb_elem_local_[1] * nb_elem_local_[2];
223 assert(direction >= 0 && direction < 3);
224 return nb_nodes_local_[direction];
237 assert(compo >= 0 && compo < 3);
238 assert(direction >= 0 && direction < 3);
239 return nb_faces_local_[compo][direction];
252 assert(compo >= 0 && compo < 3);
253 assert(direction >= 0 && direction < 3);
254 return nb_edges_local_[compo][direction];
271 assert(direction >= 0 && direction < 3);
306 assert(direction >= 0 && direction < 3);
307 return offset_[direction];
317 assert(direction >= 0 && direction < 3);
318 return processor_position_[direction];
333 assert(direction >= 0 && direction < 3);
334 assert(previous_or_next == 0 || previous_or_next == 1);
335 return neighbour_processors_[previous_or_next][direction];
345 assert(direction >= 0 && direction < 3);
346 return nproc_per_direction_[direction];
355 assert(direction >= 0 && direction < 3);
356 return node_coordinates_xyz_[direction];
365 assert(direction >= 0 && direction < 3);
366 return node_coordinates_xyz_[direction][0];
375 assert(direction >= 0 && direction < 3);
376 return delta_xyz_[direction];
389 assert(direction >= 0 && direction < 3);
392 Cerr <<
"Error in Domaine_IJK::get_constant_delta: grid is not uniform in direction : " << direction << finl;
395 return delta_xyz_[direction][0];
410 ArrOfDouble_with_ghost& delta)
const;
430 assert(direction >= 0 && direction < 3);
431 tab = offsets_all_slices_[direction];
450 return mapping_(slice[0], slice[1], slice[2]);
462 return mapping_(slice_i, slice_j, slice_k);
505 bool within_ghost(
int i,
int j,
int k,
int negative_ghost_size,
int positive_ghost_size)
const;
509 bool within_ghost_along_dir(
int dir,
int i,
int j,
int k,
int negative_ghost_size,
int positive_ghost_size)
const;
512 bool within_ghost_(
int i,
int j,
int k,
int negative_ghost_size,
int positive_ghost_size)
const
514 int dir =
static_cast<int>(_DIR_);
566 void search_elem(
const double& x,
const double& y,
const double& z,
577 assert(direction >= 0 && direction < 3);
578 return periodic_[direction];
587 assert(direction >= 0 && direction < 3);
588 return uniform_[direction];
600 assert(volume_elem_.size_array() > 0 &&
"volume_elem_ is empty. Update before trying to read it.");
601 assert(volume_elem_.size_array() ==
get_nb_elem_local() &&
"volume_elem_ is not up to date. Update before trying to read it.");
602 assert(volume_elem_status_ ==
DONE);
619 VECT(ArrOfDouble) node_coordinates_xyz_;
625 VECT(ArrOfDouble) delta_xyz_;
631 VECT(ArrOfInt) offsets_all_slices_;
633 VECT(ArrOfInt) sizes_all_slices_;
635 bool uniform_[3] = {
false,
false,
false};
637 bool periodic_[3] = {
false,
false,
false};
644 FixedVector<int, 3> processor_position_;
648 FixedVector<int, 3> nb_elem_local_;
652 FixedVector<int, 3> nb_nodes_local_;
654 FixedVector<FixedVector<int, 3>, 3> nb_faces_local_;
656 FixedVector<FixedVector<int, 3>, 3> nb_edges_local_;
658 FixedVector<int, 3> offset_;
664 FixedVector<FixedVector<int, 3>, 2> neighbour_processors_;
666 DoubleVect volume_elem_;
670 int ft_extension_ = 0;
676 int gi = i + offset_[dir];
680 bool loc_equal_dir = (((loc ==
FACES_I) && (dir == 0)) || ((loc ==
FACES_J) && (dir == 1)) || ((loc ==
FACES_K) && (dir == 2)));
681 bool loc_equal_dir_or_nodes_or_edges = loc_equal_dir || loc_edges || (loc ==
NODES);
683 bool loc_equal_edge_dir = (((loc ==
EDGES_I) && (dir == 0)) || ((loc ==
EDGES_J) && (dir == 1)) || ((loc ==
EDGES_K) && (dir == 2)));
685 if (!loc_equal_dir_or_nodes_or_edges)
688 if (loc_equal_edge_dir)
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
void set_extension_from_bulle_param(double vol_bulle, double diam_bulle)
int get_offset_local(int direction) const
Returns the local offset in requested direction.
int get_neighbour_processor(int previous_or_next, int direction) const
Returns the index of the requested neighbour processor (-1 if no neighbour).
int get_nb_elem_local() const
Returns the number of element owned by this processor.
int get_processor_by_ijk(const FixedVector< int, 3 > &slice) const
Return the global index of the processor according to its position.
int get_independent_index(int i, int j, int k) const
void update_volume_elem()
Updates volume_elem_ / ! \ If the grid changes, this needs to be called again!
bool within_ghost(int i, int j, int k, int negative_ghost_size, int positive_ghost_size) const
int periodic_get_processor_by_ijk(int slice_i, int slice_j, int slice_k) const
void init_subregion(const Domaine_IJK &src, int ni, int nj, int nk, int offset_i, int offset_j, int offset_k, const Nom &subregion, bool perio_x=false, bool perio_y=false, bool perio_z=false)
Builds the geometry, parallel splitting and DOF correspondance between a "father" region and a "son" ...
bool within_ghost_along_dir(int dir, int i, int j, int k, int negative_ghost_size, int positive_ghost_size) const
bool is_uniform(int direction) const
Method returns true if uniform in this direction.
int get_nb_faces_local(int compo, int direction) const
Returns the number, in requested direction, of faces that are oriented in direction of "compo".
Faces * creer_faces()
Returns new(Faces)! Overridden by Domaine_VDF for example.
int get_nb_elem_local(int direction) const
Returns the number of elements owned by this processor in the given direction.
int get_nb_elem_tot() const
Returns the total (global) number of mesh cells.
int get_nb_edges_local(int compo, int direction) const
Returns the number, in requested direction, of edges of faces in direction of "compo".
grid_status
status sub class to not compute the same structure twitce when not needed
bool get_periodic_flag(int direction) const
Method returns true if periodic in this direction.
static Localisation Faces_Dir_To_Localisation(int direction)
Returns the face according to the direction.
double get_domain_length(int direction) const
Returns the length of the entire domain in requested direction.
int get_nprocessor_per_direction(int direction) const
Returns the number of slices in the given direction.
int get_i_along_dir_no_perio(int direction, double coord_dir, Localisation loc) const
Int3 get_ijk_from_independent_index(int independent_index) const
void initialize_from_unstructured(const Domaine &, int direction_for_x, int direction_for_y, int direction_for_z, bool perio_x, bool perio_y, bool perio_z)
int get_nb_items_local(Localisation loc, int direction) const
Returns the number of local items (on this processor) for the given localisation in the requested dir...
void get_local_mesh_delta(int direction, int ghost_cells, ArrOfDouble_with_ghost &delta) const
Fills the "delta" array with the size of the cells owned by the processor in the requested direction.
int get_processor_by_ijk(int slice_i, int slice_j, int slice_k) const
Return the global index of the processor according to its position.
double get_coord_of_dof_along_dir(int dir, int i, Localisation loc) const
double get_constant_delta(int direction) const
Returns the size of cells in a direction.
static Localisation Edges_Dir_To_Localisation(int direction)
int get_phase_from_signed_independent_index(int signed_independent_index) const
void get_processor_mapping(IntTab &mapping) const
Fills an array containing the mapping of processors.
int get_i_along_dir_perio(int direction, double coord_dir, Localisation loc) const
const ArrOfDouble & get_delta(int direction) const
Returns the array of mesh cell sizes in requested direction.
double get_origin(int direction) const
Returns the coordinate of the first node (global) of the mesh in the requested direction.
int get_signed_independent_index(int phase, int i, int j, int k) const
void initialize_splitting(Domaine_IJK &dom, int nproc_i, int nproc_j, int nproc_k, int process_grouping_i=1, int process_grouping_j=1, int process_grouping_k=1)
Buils a splitting of the given deometry on the requested number of processors in each direction.
int correct_perio_i_local(int direction, int i) const
int get_independent_index_from_signed_independent_index(int signed_independent_index) const
void get_slice_offsets(int direction, ArrOfInt &tab) const
Returns the indices of the first cell in requested direction of every slices in this direction.
int get_nb_items_global(Localisation loc, int direction) const
Returns the number of local items (on this processor) for the given localisation in the requested dir...
void initialize_mapping(Domaine_IJK &dom, const ArrOfInt &slice_size_i, const ArrOfInt &slice_size_j, const ArrOfInt &slice_size_k, const IntTab &processor_mapping)
Creates a splitting of the domain by specifying the slice sizes and the processor mapping.
Vecteur3 get_coords_of_dof(int i, int j, int k, Localisation loc) const
Determines the dof of an element along a localisation.
int convert_ijk_cell_to_packed(const FixedVector< int, 3 > ijk) const
Converts the ijk index of an element to a cell index.
int get_nb_elem_tot(int direction) const
Returns the total (global) number of mesh cells in requested direction.
void get_slice_size(int direction, Localisation loc, ArrOfInt &tab) const
Returns the number of items of given location (elements, nodes, faces...) for all slices in the reque...
const ArrOfDouble & get_node_coordinates(int direction) const
Returns an array with the coordinates of all nodes in the mesh in requested direction.
int get_nb_nodes_local(int direction) const
Returns the number of nodes owned by this processor (generally equal to nb_elem_local()).
FixedVector< int, 3 > convert_packed_to_ijk_cell(int index) const
Convert the local index of an element to a vector with IJK indices.
void initialize_origin_deltas(double x0, double y0, double z0, const ArrOfDouble &delta_x, const ArrOfDouble &delta_y, const ArrOfDouble &delta_z, bool perio_x, bool perio_y, bool perio_z)
Initializes class elements given dataset's parameters.
int get_local_slice_index(int direction) const
Returns the position of the local subdomain in the requested direction.
bool within_ghost_(int i, int j, int k, int negative_ghost_size, int positive_ghost_size) const
void initialize_with_mapping(const ArrOfInt &slice_size_i, const ArrOfInt &slice_size_j, const ArrOfInt &slice_size_k, const IntTab &processor_mapping)
Creates a splitting of the domain by specifying the mapping.
const DoubleVect & get_volume_elem() const
Returns volume_elem_.
Localisation
Localisation sub class.
void search_elem(const double &x, const double &y, const double &z, FixedVector< int, 3 > &ijk_global, FixedVector< int, 3 > &ijk_local, FixedVector< int, 3 > &ijk_me) const
Find the element which contains the item's coodirnates.
Int3 get_ijk_from_coord(double coord_x, double coord_y, double coord_z, Localisation loc) const
Base class for domains description. This class holds all the data shared by all domains and not sensi...
class Nom: a character string for naming TRUST objects.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
_SIZE_ size_array() const