1111#include " openmc/settings.h"
1212#include " openmc/string_utils.h"
1313
14- #ifdef UWUW
14+ #ifdef OPENMC_UWUW
1515#include " uwuw.hpp"
1616#endif
1717#include < fmt/core.h>
@@ -29,7 +29,7 @@ const bool DAGMC_ENABLED = true;
2929const bool DAGMC_ENABLED = false ;
3030#endif
3131
32- #ifdef UWUW
32+ #ifdef OPENMC_UWUW
3333const bool UWUW_ENABLED = true ;
3434#else
3535const bool UWUW_ENABLED = false ;
@@ -112,6 +112,11 @@ void DAGUniverse::initialize()
112112{
113113 geom_type () = GeometryType::DAG ;
114114
115+ #ifdef OPENMC_UWUW
116+ // read uwuw materials from the .h5m file if present
117+ read_uwuw_materials ();
118+ #endif
119+
115120 init_dagmc ();
116121
117122 init_metadata ();
@@ -431,16 +436,16 @@ void DAGUniverse::to_hdf5(hid_t universes_group) const
431436
432437bool DAGUniverse::uses_uwuw () const
433438{
434- #ifdef UWUW
439+ #ifdef OPENMC_UWUW
435440 return uwuw_ && !uwuw_->material_library .empty ();
436441#else
437442 return false ;
438- #endif // UWUW
443+ #endif // OPENMC_UWUW
439444}
440445
441446std::string DAGUniverse::get_uwuw_materials_xml () const
442447{
443- #ifdef UWUW
448+ #ifdef OPENMC_UWUW
444449 if (!uses_uwuw ()) {
445450 throw std::runtime_error (" This DAGMC Universe does not use UWUW materials" );
446451 }
@@ -460,12 +465,12 @@ std::string DAGUniverse::get_uwuw_materials_xml() const
460465 return ss.str ();
461466#else
462467 fatal_error (" DAGMC was not configured with UWUW." );
463- #endif // UWUW
468+ #endif // OPENMC_UWUW
464469}
465470
466471void DAGUniverse::write_uwuw_materials_xml (const std::string& outfile) const
467472{
468- #ifdef UWUW
473+ #ifdef OPENMC_UWUW
469474 if (!uses_uwuw ()) {
470475 throw std::runtime_error (
471476 " This DAGMC universe does not use UWUW materials." );
@@ -478,7 +483,7 @@ void DAGUniverse::write_uwuw_materials_xml(const std::string& outfile) const
478483 mats_xml.close ();
479484#else
480485 fatal_error (" DAGMC was not configured with UWUW." );
481- #endif
486+ #endif // OPENMC_UWUW
482487}
483488
484489void DAGUniverse::legacy_assign_material (
@@ -540,7 +545,7 @@ void DAGUniverse::legacy_assign_material(
540545
541546void DAGUniverse::read_uwuw_materials ()
542547{
543- #ifdef UWUW
548+ #ifdef OPENMC_UWUW
544549 // If no filename was provided, don't read UWUW materials
545550 if (filename_ == " " )
546551 return ;
@@ -580,16 +585,13 @@ void DAGUniverse::read_uwuw_materials()
580585 }
581586#else
582587 fatal_error (" DAGMC was not configured with UWUW." );
583- #endif
588+ #endif // OPENMC_UWUW
584589}
585590
586591void DAGUniverse::uwuw_assign_material (
587592 moab::EntityHandle vol_handle, std::unique_ptr<DAGCell>& c) const
588593{
589- #ifdef UWUW
590- // read materials from uwuw material file
591- read_uwuw_materials ();
592-
594+ #ifdef OPENMC_UWUW
593595 // lookup material in uwuw if present
594596 std::string uwuw_mat = dmd_ptr->volume_material_property_data_eh [vol_handle];
595597 if (uwuw_->material_library .count (uwuw_mat) != 0 ) {
@@ -601,11 +603,11 @@ void DAGUniverse::uwuw_assign_material(
601603 } else {
602604 fatal_error (fmt::format (" Material with value '{}' not found in the "
603605 " UWUW material library" ,
604- mat_str ));
606+ uwuw_mat ));
605607 }
606608#else
607609 fatal_error (" DAGMC was not configured with UWUW." );
608- #endif
610+ #endif // OPENMC_UWUW
609611}
610612// ==============================================================================
611613// DAGMC Cell implementation
0 commit comments