Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Unit Test #35

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int main( int argc, char *argv[] )

Kokkos::ScopeGuard scope_guard( argc, argv );

{
CabanaMD cabanamd;
cabanamd.init( argc, argv );

Expand All @@ -68,8 +69,7 @@ int main( int argc, char *argv[] )
// cabanamd.check_correctness();

cabanamd.print_performance();

cabanamd.shutdown();
} // cabanamd's destructor called

MPI_Finalize();
}
26 changes: 20 additions & 6 deletions src/cabanamd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@

#define MAXPATHLEN 1024

CabanaMD::CabanaMD()
CabanaMD::CabanaMD() :
integrator(nullptr), force(nullptr), comm(nullptr), binning(nullptr)
{
// Create the System class: atom properties (AoSoA) and simulation box
system = new System();
Expand Down Expand Up @@ -102,10 +103,13 @@ void CabanaMD::init( int argc, char *argv[] )
// Create Binning class: linked cell bin sort
binning = new Binning( system );

// Create Communication class: MPI
comm = new Comm( system, neigh_cutoff );

// Create Force class: potential options in force_types/ folder
if ( false )
{
}
} // NOTE: modules_force cannot change neigh_cutoff!
#define FORCE_MODULES_INSTANTIATION
#include <modules_force.h>
#undef FORCE_MODULES_INSTANTIATION
Expand All @@ -119,9 +123,6 @@ void CabanaMD::init( int argc, char *argv[] )
input->input_data.words[input->force_coeff_lines( line )] );
}

// Create Communication class: MPI
comm = new Comm( system, neigh_cutoff );

force->comm_newton = input->comm_newton;

// system->print_particles();
Expand Down Expand Up @@ -564,4 +565,17 @@ void CabanaMD::check_correctness( int step )

void CabanaMD::print_performance() {}

void CabanaMD::shutdown() { system->destroy(); }
CabanaMD::~CabanaMD()
frobnitzem marked this conversation as resolved.
Show resolved Hide resolved
{
delete system;
delete input;

if(integrator != nullptr)
delete integrator;
if(force != nullptr)
delete force;
frobnitzem marked this conversation as resolved.
Show resolved Hide resolved
if(comm != nullptr)
delete comm;
if(binning != nullptr)
delete binning;
}
5 changes: 2 additions & 3 deletions src/cabanamd.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ class CabanaMD
{
public:
System *system;
Input *input;
Integrator *integrator;
Force *force;
Comm *comm;
Input *input;
Binning *binning;

CabanaMD();
~CabanaMD();

void init( int argc, char *argv[] );

Expand All @@ -77,6 +78,4 @@ class CabanaMD
void check_correctness( int );

void print_performance();

void shutdown();
};
Loading