mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Add a cpp driver test for comparing mesh tallies with internal and external moab ptrs: currently fails because feature not implemented
This commit is contained in:
parent
cbfcf908f8
commit
c8db88dff2
5 changed files with 410 additions and 0 deletions
50
tests/regression_tests/external_moab/main.cpp
Normal file
50
tests/regression_tests/external_moab/main.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#include "openmc/capi.h"
|
||||
#include "openmc/error.h"
|
||||
#include "openmc/mesh.h"
|
||||
#include <iostream>
|
||||
#include "moab/Core.hpp"
|
||||
|
||||
int main(int argc, char * argv[]){
|
||||
|
||||
using namespace openmc;
|
||||
int openmc_err;
|
||||
|
||||
// Create MOAB interface
|
||||
std::shared_ptr<moab::Interface> moabPtrLocal =
|
||||
std::make_shared<moab::Core>();
|
||||
|
||||
// Load unstructured mesh file
|
||||
std::string filename = "test_mesh_tets.h5m";
|
||||
moab::ErrorCode rval = moabPtrLocal->load_file(filename.c_str());
|
||||
if (rval != moab::MB_SUCCESS) {
|
||||
fatal_error("Failed to load the unstructured mesh file: " + filename);
|
||||
}
|
||||
else{
|
||||
std::cout<<"Loaded external mesh from file "<<filename<<std::endl;
|
||||
}
|
||||
|
||||
// Initialise OpenMC
|
||||
openmc_err = openmc_init(argc, argv, nullptr);
|
||||
|
||||
if (openmc_err == -1) {
|
||||
// This happens for the -h and -v flags
|
||||
return EXIT_SUCCESS;
|
||||
} else if (openmc_err) {
|
||||
fatal_error(openmc_err_msg);
|
||||
}
|
||||
|
||||
// Create a new unstructured mesh tally using new constructor
|
||||
|
||||
// Add unstructured mesh tally to openmc
|
||||
|
||||
// Run OpenMC
|
||||
openmc_err = openmc_run();
|
||||
if (openmc_err) fatal_error(openmc_err_msg);
|
||||
|
||||
// Deallocate memory
|
||||
openmc_err = openmc_finalize();
|
||||
if (openmc_err) fatal_error(openmc_err_msg);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue