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.
Add test for a VPP that declares a vector fairly late refs idaholab#7809
- Loading branch information
Showing
6 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
test/include/vectorpostprocessors/LateDeclarationVectorPostprocessor.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/****************************************************************/ | ||
/* 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 LATEDECLARATIONVECTORPOSTPROCESSOR_H | ||
#define LATEDECLARATIONVECTORPOSTPROCESSOR_H | ||
|
||
#include "GeneralVectorPostprocessor.h" | ||
|
||
//Forward Declarations | ||
class LateDeclarationVectorPostprocessor; | ||
|
||
template<> | ||
InputParameters validParams<LateDeclarationVectorPostprocessor>(); | ||
|
||
class LateDeclarationVectorPostprocessor : public GeneralVectorPostprocessor | ||
{ | ||
public: | ||
LateDeclarationVectorPostprocessor(const InputParameters & parameters); | ||
|
||
virtual void initialize() override; | ||
virtual void execute() override; | ||
|
||
protected: | ||
VectorPostprocessorValue * _value; | ||
}; | ||
|
||
#endif |
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
44 changes: 44 additions & 0 deletions
44
test/src/vectorpostprocessors/LateDeclarationVectorPostprocessor.C
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,44 @@ | ||
/****************************************************************/ | ||
/* 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 "LateDeclarationVectorPostprocessor.h" | ||
|
||
template<> | ||
InputParameters validParams<LateDeclarationVectorPostprocessor>() | ||
{ | ||
InputParameters params = validParams<GeneralVectorPostprocessor>(); | ||
|
||
params.addRequiredParam<VectorPostprocessorValue>("value", "The vector value this object will have."); | ||
return params; | ||
} | ||
|
||
LateDeclarationVectorPostprocessor::LateDeclarationVectorPostprocessor(const InputParameters & parameters) : | ||
GeneralVectorPostprocessor(parameters), | ||
_value(nullptr) | ||
{ | ||
} | ||
|
||
void | ||
LateDeclarationVectorPostprocessor::initialize() | ||
{ | ||
if (_t_step == 1) | ||
_value = &declareVector("value"); | ||
} | ||
|
||
void | ||
LateDeclarationVectorPostprocessor::execute() | ||
{ | ||
if (_t_step == 1) | ||
*_value = getParam<VectorPostprocessorValue>("value"); | ||
} |
4 changes: 4 additions & 0 deletions
4
...ion_vector_postprocessor/gold/late_declaration_vector_postprocessor_out_constant_0001.csv
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,4 @@ | ||
value | ||
1.5 | ||
2.7 | ||
|
53 changes: 53 additions & 0 deletions
53
...tprocessors/late_declaration_vector_postprocessor/late_declaration_vector_postprocessor.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,53 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
nx = 10 | ||
ny = 10 | ||
[] | ||
|
||
[Variables] | ||
[./u] | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
[./diff] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
[./left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = left | ||
value = 0 | ||
[../] | ||
[./right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = right | ||
value = 1 | ||
[../] | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[./constant] | ||
type = LateDeclarationVectorPostprocessor | ||
value = '1.5 2.7' | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
# Preconditioned JFNK (default) | ||
type = Steady | ||
solve_type = PJFNK | ||
petsc_options_iname = '-pc_type -pc_hypre_type' | ||
petsc_options_value = 'hypre boomeramg' | ||
[] | ||
|
||
[Outputs] | ||
execute_on = 'initial timestep_end' | ||
csv = true | ||
[] |
7 changes: 7 additions & 0 deletions
7
test/tests/vectorpostprocessors/late_declaration_vector_postprocessor/tests
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,7 @@ | ||
[Tests] | ||
[./test] | ||
type = 'CSVDiff' | ||
input = 'late_declaration_vector_postprocessor.i' | ||
csvdiff = 'late_declaration_vector_postprocessor_out_constant_0001.csv' | ||
[../] | ||
[] |