From afb9f02dbf92c06e58d59021a92706179df46eed Mon Sep 17 00:00:00 2001 From: pshriwise Date: Tue, 25 Sep 2018 20:25:17 -0500 Subject: [PATCH] Updates to style. Moving dagmc header with other headers. --- {src => include/openmc}/dagmc.h | 4 +-- src/cell.cpp | 8 ++---- src/dagmc.cpp | 50 +++++++++++++-------------------- src/input_xml.F90 | 4 +-- src/surface.cpp | 4 +-- 5 files changed, 27 insertions(+), 43 deletions(-) rename {src => include/openmc}/dagmc.h (84%) diff --git a/src/dagmc.h b/include/openmc/dagmc.h similarity index 84% rename from src/dagmc.h rename to include/openmc/dagmc.h index d417b072f9..309cf17068 100644 --- a/src/dagmc.h +++ b/include/openmc/dagmc.h @@ -1,8 +1,8 @@ #ifdef DAGMC -#ifndef DAGMC_H -#define DAGMC_H +#ifndef OPEN_DAGMC_H +#define OPEN_DAGMC_H #include "DagMC.hpp" #include "openmc/cell.h" diff --git a/src/cell.cpp b/src/cell.cpp index ac7bc45688..6fad3adb98 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -18,8 +18,6 @@ //TODO: remove this include #include -//extern "C" {int32_t n_cells {0};} - namespace openmc { //============================================================================== @@ -605,11 +603,9 @@ std::pair DAGCell::distance(Position p, Direction u, int32_t on rval = dagmc_ptr_->ray_fire(vol, p.xyz, u.xyz, hit_surf, dist); MB_CHK_ERR_CONT(rval); int surf_idx; - if(hit_surf != 0) { + if (hit_surf != 0) { surf_idx = dagmc_ptr_->index_by_handle(hit_surf); - } - // indicate that particle is lost - else { + } else { // indicate that particle is lost surf_idx = -1; } diff --git a/src/dagmc.cpp b/src/dagmc.cpp index afb3199861..4e38263d70 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -1,19 +1,18 @@ #ifdef DAGMC -#include "dagmc.h" +#include "openmc/dagmc.h" #include "openmc/error.h" +#include "openmc/string_functions.h" #include #include moab::DagMC* DAG; -#define TOLOWER(S) std::transform(S.begin(), S.end(), S.begin(), ::tolower) - void load_dagmc_geometry_c() { - if(!DAG) { + if (!DAG) { DAG = new moab::DagMC(); } @@ -35,7 +34,7 @@ void load_dagmc_geometry_c() // initialize cell objects openmc::n_cells = DAG->num_entities(3); - for(int i = 0; i < openmc::n_cells; i++) { + for (int i = 0; i < openmc::n_cells; i++) { moab::EntityHandle vol_handle = DAG->entity_by_index(3, i+1); // set cell ids using global IDs @@ -55,31 +54,28 @@ void load_dagmc_geometry_c() openmc::universes.back()-> id_ = dagmc_univ_id; openmc::universes.back()->cells_.push_back(i); openmc::universe_map[dagmc_univ_id] = openmc::universes.size() - 1; - } - else { + } else { openmc::universes[it->second]->cells_.push_back(i); } - if(DAG->is_implicit_complement(vol_handle)) { + if (DAG->is_implicit_complement(vol_handle)) { // assuming implicit complement is void for now c->material_.push_back(openmc::MATERIAL_VOID); continue; } - if(DAG->has_prop(vol_handle, "mat")){ + if (DAG->has_prop(vol_handle, "mat")){ std::string mat_value; rval = DAG->prop_value(vol_handle, "mat", mat_value); MB_CHK_ERR_CONT(rval); - TOLOWER(mat_value); + openmc::to_lower(mat_value); - if(mat_value == "void" || mat_value == "vacuum") { + if (mat_value == "void" || mat_value == "vacuum") { c->material_.push_back(openmc::MATERIAL_VOID); - } - else { + } else { c->material_.push_back(std::stoi(mat_value)); } - } - else { + } else { std::cout << c->id_ << std::endl; openmc::fatal_error("A volume without a material was found."); } @@ -89,7 +85,7 @@ void load_dagmc_geometry_c() openmc::n_surfaces = DAG->num_entities(2); openmc::surfaces.resize(openmc::n_surfaces); - for(int i = 0; i < openmc::n_surfaces; i++) { + for (int i = 0; i < openmc::n_surfaces; i++) { moab::EntityHandle surf_handle = DAG->entity_by_index(2, i+1); // set cell ids using global IDs @@ -97,33 +93,27 @@ void load_dagmc_geometry_c() s->id_ = DAG->id_by_index(2, i+1); s->dagmc_ptr_ = DAG; - if(DAG->has_prop(surf_handle, "boundary")) { + if (DAG->has_prop(surf_handle, "boundary")) { std::string bc_value; rval = DAG->prop_value(surf_handle, "boundary", bc_value); MB_CHK_ERR_CONT(rval); - TOLOWER(bc_value); + openmc::to_lower(bc_value); - if(bc_value == "transmit" || bc_value == "transmission") { + if (bc_value == "transmit" || bc_value == "transmission") { s->bc_ = openmc::BC_TRANSMIT; - } - else if(bc_value == "vacuum") { + } else if (bc_value == "vacuum") { s->bc_ = openmc::BC_VACUUM; - } - else if(bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") { + } else if (bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") { s->bc_ = openmc::BC_REFLECT; - } - else if(bc_value == "periodic") { + } else if (bc_value == "periodic") { openmc::fatal_error("Periodic boundary condition not supported in DAGMC."); - } - else { + } else { std::stringstream err_msg; err_msg << "Unknown boundary condition \"" << s->bc_ << "\" specified on surface " << s->id_; openmc::fatal_error(err_msg); } - } - // if no BC property is found, set to transmit - else { + } else { // if no BC property is found, set to transmit s->bc_ = openmc::BC_TRANSMIT; } diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 00415bfe81..f90d874b47 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -638,7 +638,7 @@ contains call surface_dict % set(surfaces(i) % id(), i) end do - end subroutine allocate_surfaces + end subroutine allocate_surfaces subroutine allocate_cells() integer :: i @@ -941,7 +941,7 @@ contains end if ! Create list of macroscopic x/s based on those specified, just treat - ! them as nuclides. This is all really a fadagmce so the user thinks they + ! them as nuclides. This is all really a facade so the user thinks they ! are entering in macroscopic data but the code treats them the same ! as nuclides internally. ! Get pointer list of XML diff --git a/src/surface.cpp b/src/surface.cpp index 832668e064..0ec049bab3 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -178,7 +178,7 @@ Surface::Surface(pugi::xml_node surf_node) } } - + bool Surface::sense(Position r, Direction u) const { @@ -1286,8 +1286,6 @@ extern "C" { uvw[2] = u.z; } - void surface_to_hdf5(CSGSurface* surf, hid_t group) {surf->to_hdf5(group);} - bool surface_periodic(PeriodicSurface* surf, PeriodicSurface* other, double xyz[3], double uvw[3])