Chi-Tech
chi_volumemesher_01d_set_ortho_bndries.cc
Go to the documentation of this file.
2
5
6#include "chi_runtime.h"
7#include "chi_log.h"
8
9#include "utils/chi_timer.h"
10
11//###################################################################
12/**Sets boundary numbers on boundaries orthogonal to the cardinal directions
13 * as "XMAX", "XMIN", "YMAX", "YMIN", "ZMAX", "ZMIN".*/
15{
18 << " Setting orthogonal boundaries.";
19
20 //============================================= Get current mesh handler
21 auto& handler = chi_mesh::GetCurrentHandler();
22
23 //============================================= Get back mesh
24 auto vol_cont = handler.GetGrid();
25
26 const chi_mesh::Vector3 ihat(1.0, 0.0, 0.0);
27 const chi_mesh::Vector3 jhat(0.0, 1.0, 0.0);
28 const chi_mesh::Vector3 khat(0.0, 0.0, 1.0);
29
30 for (auto& cell : vol_cont->local_cells)
31 for (auto& face : cell.faces_)
32 if (not face.has_neighbor_)
33 {
34 chi_mesh::Vector3& n = face.normal_;
35
36 std::string boundary_name;
37 if (n.Dot(ihat)>0.999) boundary_name = "XMAX";
38 else if (n.Dot(ihat)<-0.999) boundary_name = "XMIN";
39 else if (n.Dot(jhat)> 0.999) boundary_name = "YMAX";
40 else if (n.Dot(jhat)<-0.999) boundary_name = "YMIN";
41 else if (n.Dot(khat)> 0.999) boundary_name = "ZMAX";
42 else if (n.Dot(khat)<-0.999) boundary_name = "ZMIN";
43
44 uint64_t bndry_id = vol_cont->MakeBoundaryID(boundary_name);
45
46 face.neighbor_id_ = bndry_id;
47
48 vol_cont->GetBoundaryIDMap()[bndry_id] = boundary_name;
49 }//if bndry
50
54 << " Done setting orthogonal boundaries.";
55}
static chi::Timer program_timer
Definition: chi_runtime.h:79
static chi::ChiLog & log
Definition: chi_runtime.h:81
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
LogStream Log(LOG_LVL level=LOG_0)
Definition: chi_log.cc:35
void Barrier() const
Definition: mpi_info.cc:38
std::string GetTimeString() const
Definition: chi_timer.cc:38
MeshHandler & GetCurrentHandler()
Vector3 Dot(const chi_mesh::TensorRank2Dim3 &that) const