Chi-Tech
volmesher_extruder_execute.cc
Go to the documentation of this file.
6
7#include "chi_runtime.h"
8#include "chi_log.h"
9#include "chi_mpi.h"
10
11
12#include "utils/chi_timer.h"
13
14#include "console/chi_console.h"
15
16#include <iostream>
17
18//###################################################################
19/**Execution... nough said.*/
21{
24 << " VolumeMesherExtruder executed. Memory in use = "
26 << std::endl;
27
28 //================================================== Loop over all regions
30 << "VolumeMesherExtruder: Processing Region"
31 << std::endl;
32
33 //=========================================== Create new continuum
34 auto grid = chi_mesh::MeshContinuum::New();
35 auto temp_grid = chi_mesh::MeshContinuum::New();
36
37 SetContinuum(grid);
39
40 //================================== Setup layers
41 // populates vertex-layers
43 << "VolumeMesherExtruder: Setting up layers" << std::endl;
45
46 //================================== Process templates
48 {
50 << "VolumeMesherExtruder: Processing unpartitioned mesh"
51 << std::endl;
52
53 //================================== Get node_z_incr
55
56 //================================== Create baseline polygons in template
57 // continuum
59 << "VolumeMesherExtruder: Creating template cells" << std::endl;
61
62 grid->GetBoundaryIDMap() =
63 template_unpartitioned_mesh_->GetMeshOptions().boundary_id_map;
64 temp_grid->GetBoundaryIDMap() =
65 template_unpartitioned_mesh_->GetMeshOptions().boundary_id_map;
66 }
67
69 << "VolumeMesherExtruder: Creating local nodes" << std::endl;
70 CreateLocalNodes(*temp_grid, *grid);
71
73 << "VolumeMesherExtruder: Done creating local nodes" << std::endl;
74
75 //================================== Insert top and bottom boundary
76 // id map
77 auto& grid_bndry_id_map = grid->GetBoundaryIDMap();
78 zmax_bndry_id = grid->MakeBoundaryID("ZMAX");
79 grid_bndry_id_map[zmax_bndry_id] = "ZMAX";
80 zmin_bndry_id = grid->MakeBoundaryID("ZMIN");
81 grid_bndry_id_map[zmin_bndry_id] = "ZMIN";
82
83
84 //================================== Create extruded item_id
86 << "VolumeMesherExtruder: Extruding cells" << std::endl;
88 ExtrudeCells(*temp_grid, *grid);
89
90 size_t total_local_cells = grid->local_cells.size();
91 size_t total_global_cells = 0;
92
93 MPI_Allreduce(&total_local_cells,
94 &total_global_cells,
95 1,
96 MPI_UNSIGNED_LONG_LONG,
97 MPI_SUM,
98 Chi::mpi.comm);
99
100 Chi::log.Log()
101 << "VolumeMesherExtruder: Cells extruded = "
102 << total_global_cells
103 << std::endl;
104
105 //================================== Checking partitioning parameters
107 {
109 << "Any partitioning scheme other than KBA_STYLE_XYZ is currently not"
110 " supported by VolumeMesherExtruder. No worries. There are plans"
111 " to develop this support.";
112 Chi::Exit(EXIT_FAILURE);
113 }
114 if (!options.mesh_global)
115 {
117
118 if (Chi::mpi.process_count != p_tot)
119 {
121 << "ERROR: Number of processors available ("
122 << Chi::mpi.process_count << ") does not match amount of processors "
123 << "required by surface mesher partitioning parameters ("
124 << p_tot << ").";
125 Chi::Exit(EXIT_FAILURE);
126 }
127 }//if mesh-global
128
129 Chi::log.LogAllVerbose1() << "Building local cell indices";
130
131 //================================== Print info
133 << "### LOCATION[" << Chi::mpi.location_id
134 << "] amount of local cells="
135 << grid->local_cells.size();
136
137 Chi::log.Log()
138 << "VolumeMesherExtruder: Number of cells in region = "
139 << total_global_cells
140 << std::endl;
141
143}
static chi::Timer program_timer
Definition: chi_runtime.h:79
static void Exit(int error_code)
Definition: chi_runtime.cc:342
static chi::ChiLog & log
Definition: chi_runtime.h:81
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
LogStream LogAllVerbose1()
Definition: chi_log.h:241
LogStream LogAllError()
Definition: chi_log.h:239
LogStream Log(LOG_LVL level=LOG_0)
Definition: chi_log.cc:35
LogStream Log0Verbose1()
Definition: chi_log.h:234
static double GetMemoryUsageInMB()
Get current memory usage in Megabytes.
void Barrier() const
Definition: mpi_info.cc:38
const int & process_count
Total number of processes.
Definition: mpi_info.h:27
const int & location_id
Current process rank.
Definition: mpi_info.h:26
std::string GetTimeString() const
Definition: chi_timer.cc:38
static std::shared_ptr< MeshContinuum > New()
void CreateLocalNodes(chi_mesh::MeshContinuum &template_grid, chi_mesh::MeshContinuum &grid)
std::shared_ptr< const UnpartitionedMesh > template_unpartitioned_mesh_
void ExtrudeCells(chi_mesh::MeshContinuum &template_grid, chi_mesh::MeshContinuum &grid)
void SetupLayers(int default_layer_count=1)
void SetContinuum(MeshContinuumPtr &grid)
static void CreatePolygonCells(const chi_mesh::UnpartitionedMesh &umesh, chi_mesh::MeshContinuumPtr &grid)
void SetGridAttributes(MeshAttributes new_attribs, std::array< size_t, 3 > ortho_Nis={0, 0, 0})
VOLUME_MESHER_OPTIONS options
@ EXTRUDED
Definition: chi_mesh.h:76
@ DIMENSION_3
Definition: chi_mesh.h:74