28 "scale", 1.0,
"Uniform scale to apply to the mesh after reading.");
32 std::vector<size_t>{},
33 "A list of handles to MeshGenerator objects");
38 "Handle to a GraphPartitioner object to use for parallel partitioning."
39 "This will default to PETScGraphPartitioner with a \"parmetis\" setting");
44 "Flag, when set, makes the mesh appear in full fidelity on each process");
51 scale_(params.GetParamValue<double>(
"scale")),
52 replicated_(params.GetParamValue<bool>(
"replicated_mesh"))
57 for (
const size_t input_handle : input_handles)
59 auto& mesh_generator = Chi::GetStackItem<MeshGenerator>(
61 inputs_.push_back(&mesh_generator);
65 size_t partitioner_handle;
67 partitioner_handle = params.
GetParamValue<
size_t>(
"partitioner");
72 partitioner_handle = factory.MakeRegisteredObjectOfType(
75 partitioner_ = &Chi::GetStackItem<chi::GraphPartitioner>(
82 std::unique_ptr<UnpartitionedMesh> input_umesh)
92 std::unique_ptr<UnpartitionedMesh> current_umesh =
nullptr;
93 for (
auto mesh_generator_ptr :
inputs_)
96 mesh_generator_ptr->GenerateUnpartitionedMesh(std::move(current_umesh));
97 current_umesh = std::move(new_umesh);
103 std::vector<int64_t> cell_pids;
109 auto grid_ptr =
SetupMesh(std::move(current_umesh), cell_pids);
114 new_mesher->SetContinuum(grid_ptr);
119 cur_hndlr.SetVolumeMesher(new_mesher);
127 std::array<size_t, 3> ortho_cells_per_dimension)
135 size_t num_global_cells = 0;
137 MPI_Allreduce(&num_local_cells,
140 MPI_UNSIGNED_LONG_LONG,
144 size_t max_num_local_cells;
145 MPI_Allreduce(&num_local_cells,
146 &max_num_local_cells,
148 MPI_UNSIGNED_LONG_LONG,
152 size_t min_num_local_cells;
153 MPI_Allreduce(&num_local_cells,
154 &min_num_local_cells,
156 MPI_UNSIGNED_LONG_LONG,
162 const double local_ghost_to_local_cell_ratio =
163 double(num_local_ghosts) / double(num_local_cells);
165 double average_ghost_ratio;
166 MPI_Allreduce(&local_ghost_to_local_cell_ratio,
167 &average_ghost_ratio,
175 std::stringstream outstr;
176 outstr <<
"Mesh statistics:\n";
177 outstr <<
" Global cell count : " << num_global_cells <<
"\n";
178 outstr <<
" Local cell count (avg,max,min): ";
179 outstr << avg_num_local_cells <<
",";
180 outstr << max_num_local_cells <<
",";
181 outstr << min_num_local_cells <<
"\n";
182 outstr <<
" Ghost-to-local ratio (avg) : " << average_ghost_ratio;
static std::vector< ChiObjectPtr > object_stack
static int current_mesh_handler
static chi::MPI_Info & mpi
static ChiObjectFactory & GetInstance() noexcept
static chi::InputParameters GetInputParameters()
LogStream LogAllVerbose2()
LogStream Log(LOG_LVL level=LOG_0)
const int & process_count
Total number of processes.
const int & location_id
Current process rank.
static InputParameters GetInputParameters()
bool Has(const std::string ¶m_name) const
T GetParamValue(const std::string ¶m_name) const
std::vector< T > GetParamVectorValue(const std::string ¶m_name) const
size_t GetNumGhosts() const
LocalCellHandler local_cells
void SetAttributes(MeshAttributes new_attribs, std::array< size_t, 3 > ortho_Nis={0, 0, 0})
std::shared_ptr< MeshContinuum > SetupMesh(std::unique_ptr< UnpartitionedMesh > input_umesh_ptr, const std::vector< int64_t > &cell_pids)
chi::GraphPartitioner * partitioner_
MeshGenerator(const chi::InputParameters ¶ms)
static void ComputeAndPrintStats(const chi_mesh::MeshContinuum &grid)
static void BroadcastPIDs(std::vector< int64_t > &cell_pids, int root, MPI_Comm communicator)
static void SetGridAttributes(chi_mesh::MeshContinuum &grid, MeshAttributes new_attribs, std::array< size_t, 3 > ortho_cells_per_dimension)
std::vector< MeshGenerator * > inputs_
std::vector< int64_t > PartitionMesh(const UnpartitionedMesh &input_umesh, int num_partitions)
virtual std::unique_ptr< UnpartitionedMesh > GenerateUnpartitionedMesh(std::unique_ptr< UnpartitionedMesh > input_umesh)
static chi::InputParameters GetInputParameters()
size_t PushNewHandlerAndGetIndex()
RegisterChiObject(chi_mesh, BooleanLogicalVolume)
MeshHandler & GetCurrentHandler()