Getting infrastrucure setup for loading a CAD model and creating cell instances.

This commit is contained in:
shriwise 2018-02-23 02:07:36 -06:00 committed by pshriwise
parent 45ccb2da16
commit 0e0bb25591
5 changed files with 51 additions and 10 deletions

View file

@ -311,6 +311,7 @@ add_library(libopenmc SHARED
src/algorithm.F90
src/bank_header.F90
src/api.F90
src/cad_header.F90
src/cmfd_data.F90
src/cmfd_execute.F90
src/cmfd_header.F90

View file

@ -150,10 +150,11 @@ protected:
bool contains_complex(Position r, Direction u, int32_t on_surface) const;
};
class CADCell : public Cell
class CADCell : public Cell
{
moab::DagMC *dagmc_ptr;
public:
explicit CADCell();
};

View file

@ -1,16 +1,31 @@
#include "cad.h"
extern moab::DagMC* DAGMC;
namespace moab {
void load_cad_geometry_c()
{
if(!DAGMC) {
DAGMC = new DagMC();
}
ErrorCode rval = DAGMC->load_file("dagmc.h5m");
MB_CHK_ERR_CONT(rval);
rval = DAGMC->init_OBBTree();
MB_CHK_ERR_CONT(rval);
// initialize cell objects
for(int i = 0; i < DAGMC->num_entities(3); i++){
// set cell ids using global IDs
openmc::CADCell c = openmc::CADCell();
c.id = DAGMC->id_by_index(3, 0);
openmc::cells_c.push_back(c);
}
DagMC* DAGMC;
void load_geometry() {
if(!DAGMC) { DAGMC = new DagMC(); }
ErrorCode rval;
return;
}

View file

@ -1,4 +1,9 @@
#ifndef CAD_H
#define CAD_H
#include "DagMC.hpp"
#include "cell.h"
extern "C" void load_cad_geometry_c();
#endif // CAD_H

19
src/cad_header.F90 Normal file
View file

@ -0,0 +1,19 @@
module cad_header
use, intrinsic :: ISO_C_BINDING
use hdf5
implicit none
interface
subroutine load_cad_geometry_c() bind(C)
end subroutine load_cad_geometry_c
end interface
contains
subroutine load_cad_geometry()
call load_cad_geometry_c()
end subroutine load_cad_geometry
end module cad_header