mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
read centre from xml
This commit is contained in:
parent
81ac9b0fd9
commit
f0f5e34b33
1 changed files with 12 additions and 0 deletions
12
src/mesh.cpp
12
src/mesh.cpp
|
|
@ -955,6 +955,7 @@ CylindricalMesh::CylindricalMesh(pugi::xml_node node) : StructuredMesh {node}
|
|||
grid_[0] = get_node_array<double>(node, "r_grid");
|
||||
grid_[1] = get_node_array<double>(node, "phi_grid");
|
||||
grid_[2] = get_node_array<double>(node, "z_grid");
|
||||
centre = get_node_array<double>(node, "centre");
|
||||
|
||||
if (int err = set_grid()) {
|
||||
fatal_error(openmc_err_msg);
|
||||
|
|
@ -983,6 +984,11 @@ StructuredMesh::MeshIndex CylindricalMesh::get_indices(
|
|||
mapped_r[1] += 2 * M_PI;
|
||||
}
|
||||
|
||||
// TODO: pass centre as argument
|
||||
mapped_r[0] += centre[0]
|
||||
mapped_r[1] += centre[1]
|
||||
mapped_r[2] += centre[2]
|
||||
|
||||
MeshIndex idx = StructuredMesh::get_indices(mapped_r, in_mesh);
|
||||
|
||||
idx[1] = sanitize_phi(idx[1]);
|
||||
|
|
@ -1187,6 +1193,7 @@ SphericalMesh::SphericalMesh(pugi::xml_node node) : StructuredMesh {node}
|
|||
grid_[0] = get_node_array<double>(node, "r_grid");
|
||||
grid_[1] = get_node_array<double>(node, "theta_grid");
|
||||
grid_[2] = get_node_array<double>(node, "phi_grid");
|
||||
centre = get_node_array<double>(node, "centre");
|
||||
|
||||
if (int err = set_grid()) {
|
||||
fatal_error(openmc_err_msg);
|
||||
|
|
@ -1216,6 +1223,11 @@ StructuredMesh::MeshIndex SphericalMesh::get_indices(
|
|||
mapped_r[2] += 2 * M_PI;
|
||||
}
|
||||
|
||||
// TODO: pass centre as argument
|
||||
mapped_r[0] += centre[0]
|
||||
mapped_r[1] += centre[1]
|
||||
mapped_r[2] += centre[2]
|
||||
|
||||
MeshIndex idx = StructuredMesh::get_indices(mapped_r, in_mesh);
|
||||
|
||||
idx[1] = sanitize_theta(idx[1]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue