MultiApp::MultiApp(const InputParameters & parameters): MooseObject(parameters), SetupInterface(parameters), Restartable(parameters, "MultiApps"), _fe_problem(getParam<FEProblem *>("_fe_problem")), _app_type(getParam<MooseEnum>("app_type")), _input_files(getParam<std::vector<std::string> >("input_files")), _total_num_apps(0), _my_num_apps(0), _first_local_app(0), _orig_comm(getParam<MPI_Comm>("_mpi_comm")), _my_comm(MPI_COMM_SELF), _my_rank(0), _inflation(getParam<Real>("bounding_box_inflation")), _max_procs_per_app(getParam<unsigned int>("max_procs_per_app")), _output_in_position(getParam<bool>("output_in_position")), _reset_time(getParam<Real>("reset_time")), _reset_apps(getParam<std::vector<unsigned int> >("reset_apps")), _reset_happened(false), _move_time(getParam<Real>("move_time")), _move_apps(getParam<std::vector<unsigned int> >("move_apps")), _move_positions(getParam<std::vector<Point> >("move_positions")), _move_happened(false), _has_an_app(true), _backups(declareRestartableDataWithContext<SubAppBackups>("backups", this)) { if (_move_apps.size() != _move_positions.size()) mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp "<<_name); // Fill in the _positions vector fillPositions(); _total_num_apps = _positions.size(); mooseAssert(_input_files.size() == 1 || _positions.size() == _input_files.size(), "Number of positions and input files are not the same!"); }
void MultiApp::initialSetup() { // Fill in the _positions vector fillPositions(); if (_move_apps.size() != _move_positions.size()) mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp " << name()); /// Set up our Comm and set the number of apps we're going to be working on buildComm(); if (!_has_an_app) return; MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm); _apps.resize(_my_num_apps); _backups.resize(_my_num_apps); // Initialize the backups for (unsigned int i=0; i<_my_num_apps; i++) _backups[i] = MooseSharedPointer<Backup>(new Backup); // If the user provided an unregistered app type, see if we can load it dynamically if (!AppFactory::instance().isRegistered(_app_type)) _app.dynamicAppRegistration(_app_type, getParam<std::string>("library_path")); for (unsigned int i=0; i<_my_num_apps; i++) createApp(i, _app.getGlobalTimeOffset()); // Swap back Moose::swapLibMeshComm(swapped); }
void MultiApp::init() { // Fill in the _positions vector fillPositions(); if (_move_apps.size() != _move_positions.size()) mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp "<<_name); _total_num_apps = _positions.size(); mooseAssert(_input_files.size() == 1 || _positions.size() == _input_files.size(), "Number of positions and input files are not the same!"); /// Set up our Comm and set the number of apps we're going to be working on buildComm(); if (!_has_an_app) return; MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm); _apps.resize(_my_num_apps); for (unsigned int i=0; i<_my_num_apps; i++) createApp(i, _app.getGlobalTimeOffset()); // Swap back Moose::swapLibMeshComm(swapped); }
MultiApp::MultiApp(const InputParameters & parameters): MooseObject(parameters), SetupInterface(this), Restartable(parameters, "MultiApps"), _fe_problem(*parameters.getCheckedPointerParam<FEProblem *>("_fe_problem")), _app_type(isParamValid("app_type") ? std::string(getParam<MooseEnum>("app_type")) : _fe_problem.getMooseApp().type()), _input_files(getParam<std::vector<FileName> >("input_files")), _total_num_apps(0), _my_num_apps(0), _first_local_app(0), _orig_comm(getParam<MPI_Comm>("_mpi_comm")), _my_comm(MPI_COMM_SELF), _my_rank(0), _inflation(getParam<Real>("bounding_box_inflation")), _max_procs_per_app(getParam<unsigned int>("max_procs_per_app")), _output_in_position(getParam<bool>("output_in_position")), _reset_time(getParam<Real>("reset_time")), _reset_apps(getParam<std::vector<unsigned int> >("reset_apps")), _reset_happened(false), _move_time(getParam<Real>("move_time")), _move_apps(getParam<std::vector<unsigned int> >("move_apps")), _move_positions(getParam<std::vector<Point> >("move_positions")), _move_happened(false), _has_an_app(true), _backups(declareRestartableDataWithContext<SubAppBackups>("backups", this)) { if (_move_apps.size() != _move_positions.size()) mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp " << _name); // Fill in the _positions vector fillPositions(); _total_num_apps = _positions.size(); mooseAssert(_input_files.size() == 1 || _positions.size() == _input_files.size(), "Number of positions and input files are not the same!"); /// Set up our Comm and set the number of apps we're going to be working on buildComm(); _backups.resize(_my_num_apps); // Initialize the backups for (unsigned int i=0; i<_my_num_apps; i++) _backups[i] = MooseSharedPointer<Backup>(new Backup); }
AutoPositionsMultiApp::AutoPositionsMultiApp(const InputParameters & parameters) : TransientMultiApp(parameters), BoundaryRestrictable(this, true) // true for applying to nodesets { fillPositions(); }