-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement convenience workflow for using distributed mesh
Fixes #10458. Note that the mesh splitting won't work right until we get another libmesh update in :-(
- Loading branch information
Showing
11 changed files
with
168 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef SPLITMESHACTION_H | ||
#define SPLITMESHACTION_H | ||
|
||
#include "Action.h" | ||
|
||
#include <string> | ||
|
||
class SplitMeshAction; | ||
|
||
template <> | ||
InputParameters validParams<SplitMeshAction>(); | ||
|
||
class SplitMeshAction : public Action | ||
{ | ||
public: | ||
SplitMeshAction(InputParameters params); | ||
|
||
virtual void act() override; | ||
}; | ||
|
||
#endif // SPLITMESHACTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "SplitMeshAction.h" | ||
|
||
#include "MooseApp.h" | ||
#include "MooseUtils.h" | ||
#include "MooseMesh.h" | ||
#include "libmesh/checkpoint_io.h" | ||
|
||
template <> | ||
InputParameters | ||
validParams<SplitMeshAction>() | ||
{ | ||
return validParams<Action>(); | ||
} | ||
|
||
SplitMeshAction::SplitMeshAction(InputParameters params) : Action(params) {} | ||
|
||
void | ||
SplitMeshAction::act() | ||
{ | ||
auto mesh = _app.actionWarehouse().mesh(); | ||
|
||
if (mesh->getFileName() == "" && _app.parameters().get<std::string>("split_file") == "") | ||
mooseError("Output mesh file name must be specified (with --split-file) when splitting " | ||
"non-file-based meshes"); | ||
|
||
auto splitstr = _app.parameters().get<std::string>("split_mesh"); | ||
std::vector<unsigned int> splits; | ||
bool success = MooseUtils::tokenizeAndConvert(splitstr, splits, ", "); | ||
if (!success) | ||
mooseError("invalid argument for --split-file: '", splitstr, "'"); | ||
|
||
for (std::size_t i = 0; i < splits.size(); i++) | ||
{ | ||
processor_id_type n = splits[i]; | ||
Moose::out << "Splitting " << n << " ways..." << std::endl; | ||
|
||
auto cpr = libMesh::split_mesh(*mesh, n); | ||
Moose::out << " - writing " << cpr->current_processor_ids().size() << " files per process..." | ||
<< std::endl; | ||
cpr->binary() = true; | ||
auto fname = MooseUtils::stripExtension(mesh->getFileName()) + ".cpr"; | ||
if (mesh->getFileName() == "") | ||
fname = _app.parameters().get<std::string>("split_file"); | ||
cpr->write(fname); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters