Skip to content

Commit

Permalink
Modified environment so that no preprocessor symbols are in header. T…
Browse files Browse the repository at this point in the history
…hese may

confuse builds outside of gridpack.
  • Loading branch information
Bruce J Palmer committed Oct 31, 2023
1 parent 209f5ab commit b11cb47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 17 additions & 2 deletions src/environment/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,34 @@ Environment::Environment(int argc, char **argv,const char* help,const long int&

}

#ifdef ENABLE_ENVIRONMENT_FROM_COMM
Environment::Environment(int argc, char **argv, MPI_Comm &comm): p_boostEnv(argc,argv),clparser(argc,argv),p_from_comm(false)
{
#ifdef ENABLE_ENVIRONMENT_FROM_COMM
PrintStatus();
pma_stack = 200000;
pma_heap = 200000;
if (GA_Initialize_comm(comm)) {
p_from_comm = true;
MA_init(C_DBL,pma_stack,pma_heap);
gridpack::math::Initialize(&argc,&argv);
} else {
int rank;
MPI_Comm_rank(comm,&rank);
if (rank == 0) {
std::cout<<"Initialize GA from communicator failed" << std::endl;
}
MPI_Abort(comm, 1);
}
}
#else
int rank;
MPI_Comm_rank(comm,&rank);
if (rank == 0) {
std::cout<<"Initialize GridPACK Environment from communicator not implemented"
<< std::endl;
}
MPI_Abort(comm, 1);
#endif
}

Environment::~Environment(void)
{
Expand Down
2 changes: 0 additions & 2 deletions src/environment/environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class Environment : private utility::Uncopyable
const long int& ma_heap);
Environment(int argc, char **argv);

#ifdef ENABLE_ENVIRONMENT_FROM_COMM
/**
* Initialize environment from existing communicator
* @param argc number of program command line arguments
Expand All @@ -90,7 +89,6 @@ class Environment : private utility::Uncopyable
* @return
*/
Environment(int argc, char **argv, MPI_Comm &comm);
#endif

/**
* Return true if processor is active in this environment, false otherwise.
Expand Down

0 comments on commit b11cb47

Please sign in to comment.