forked from idaholab/moose
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding PartitionerAction and enabling MooseMesh to accept custom part…
…itioner (idaholab#5543)
- Loading branch information
Sebastian Schunert
committed
Sep 23, 2015
1 parent
c5d51d8
commit 376b3de
Showing
8 changed files
with
285 additions
and
1 deletion.
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,37 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef PARTITIONERACTION_H | ||
#define PARTITIONERACTION_H | ||
|
||
#include "Action.h" | ||
|
||
class PartitionerAction; | ||
|
||
template<> | ||
InputParameters validParams<PartitionerAction>(); | ||
|
||
|
||
class PartitionerAction: public Action | ||
{ | ||
public: | ||
PartitionerAction(InputParameters params); | ||
|
||
virtual void act(); | ||
|
||
protected: | ||
MooseEnum _partitioner_type; | ||
}; | ||
|
||
#endif //PartitionerAction_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#include "PartitionerAction.h" | ||
|
||
#include "FEProblem.h" | ||
#include "MooseEnum.h" | ||
|
||
#include "libmesh/linear_partitioner.h" | ||
|
||
template<> | ||
InputParameters validParams<PartitionerAction>() | ||
{ | ||
InputParameters params = validParams<Action>(); | ||
MooseEnum partitioning("linear=0", "linear"); | ||
|
||
params.addParam<MooseEnum> ("partitioner", partitioning, "The class name of the partitioner you want to use."); | ||
return params; | ||
} | ||
|
||
PartitionerAction::PartitionerAction(InputParameters params) : | ||
Action(params), | ||
_partitioner_type(getParam<MooseEnum>("partitioner")) | ||
{ | ||
} | ||
|
||
void | ||
PartitionerAction::act() | ||
{ | ||
switch (_partitioner_type) | ||
{ | ||
case 0: | ||
_problem->mesh().setCustomPartitioner(new LinearPartitioner); | ||
break; | ||
} | ||
} |
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
87 changes: 87 additions & 0 deletions
87
test/tests/mesh/linear_partitioner/custom_linear_partitioner_test.i
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,87 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
|
||
nx = 10 | ||
ny = 100 | ||
|
||
xmin = 0.0 | ||
xmax = 1.0 | ||
|
||
ymin = 0.0 | ||
ymax = 10.0 | ||
|
||
partitioner = custom | ||
|
||
distribution = serial | ||
[] | ||
|
||
[Partitioner] | ||
partitioner_type = linear | ||
[] | ||
|
||
[Variables] | ||
active = 'u' | ||
|
||
[./u] | ||
order = FIRST | ||
family = LAGRANGE | ||
[../] | ||
[] | ||
|
||
[AuxVariables] | ||
[./proc_id] | ||
order = CONSTANT | ||
family = MONOMIAL | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
active = 'diff' | ||
|
||
[./diff] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[] | ||
|
||
[AuxKernels] | ||
[./proc_id] | ||
type = ProcessorIDAux | ||
variable = proc_id | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
active = 'left right' | ||
|
||
[./left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 3 | ||
value = 0 | ||
[../] | ||
|
||
[./right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 1 | ||
value = 1 | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
|
||
# Preconditioned JFNK (default) | ||
solve_type = 'PJFNK' | ||
[] | ||
|
||
[Outputs] | ||
file_base = out | ||
[./exodus] | ||
type = Exodus | ||
elemental_as_nodal = true | ||
[../] | ||
[] |
82 changes: 82 additions & 0 deletions
82
test/tests/mesh/linear_partitioner/linear_partitioner_test.i
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,82 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
|
||
nx = 10 | ||
ny = 100 | ||
|
||
xmin = 0.0 | ||
xmax = 1.0 | ||
|
||
ymin = 0.0 | ||
ymax = 10.0 | ||
|
||
partitioner = linear | ||
|
||
distribution = serial | ||
[] | ||
|
||
[Variables] | ||
active = 'u' | ||
|
||
[./u] | ||
order = FIRST | ||
family = LAGRANGE | ||
[../] | ||
[] | ||
|
||
[AuxVariables] | ||
[./proc_id] | ||
order = CONSTANT | ||
family = MONOMIAL | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
active = 'diff' | ||
|
||
[./diff] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[] | ||
|
||
[AuxKernels] | ||
[./proc_id] | ||
type = ProcessorIDAux | ||
variable = proc_id | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
active = 'left right' | ||
|
||
[./left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 3 | ||
value = 0 | ||
[../] | ||
|
||
[./right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 1 | ||
value = 1 | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
|
||
# Preconditioned JFNK (default) | ||
solve_type = 'PJFNK' | ||
[] | ||
|
||
[Outputs] | ||
file_base = out | ||
[./exodus] | ||
type = Exodus | ||
elemental_as_nodal = true | ||
[../] | ||
[] |