www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CrackDataSampler Class Reference

CrackDataSampler is a type of VectorPostprocessor that outputs the values of domain integrals, printed along with positions and angles along the crack front. More...

#include <CrackDataSampler.h>

Inheritance diagram for CrackDataSampler:
[legend]

Public Member Functions

 CrackDataSampler (const InputParameters &parameters)
 Class constructor. More...
 
virtual ~CrackDataSampler ()
 Destructor. More...
 
virtual void initialize ()
 Initialize, clears the postprocessor vector. More...
 
virtual void execute ()
 Populates the postprocessor vector of values with the supplied postprocessors. More...
 
virtual void finalize ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const CrackFrontDefinition *const _crack_front_definition
 
MooseEnum _position_type
 
std::vector< const PostprocessorValue * > _domain_integral_postprocessor_values
 The vector of PostprocessorValue objects that are used to get the values of the domain integral postprocessors. More...
 

Detailed Description

CrackDataSampler is a type of VectorPostprocessor that outputs the values of domain integrals, printed along with positions and angles along the crack front.

Definition at line 27 of file CrackDataSampler.h.

Constructor & Destructor Documentation

◆ CrackDataSampler()

CrackDataSampler::CrackDataSampler ( const InputParameters &  parameters)

Class constructor.

Parameters
parametersThe input parameters

Definition at line 41 of file CrackDataSampler.C.

42  : GeneralVectorPostprocessor(parameters),
43  SamplerBase(parameters, this, _communicator),
44  _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
45  _position_type(getParam<MooseEnum>("position_type"))
46 {
47  std::vector<PostprocessorName> pps_names(
48  getParam<std::vector<PostprocessorName>>("postprocessors"));
49  for (unsigned int i = 0; i < pps_names.size(); ++i)
50  {
51  if (!hasPostprocessorByName(pps_names[i]))
52  mooseError("In CrackDataSampler, postprocessor with name: ", pps_names[i], " does not exist");
53  _domain_integral_postprocessor_values.push_back(&getPostprocessorValueByName(pps_names[i]));
54  }
55  std::vector<std::string> var_names;
56  var_names.push_back(name());
57  SamplerBase::setupVariables(var_names);
58 }

◆ ~CrackDataSampler()

virtual CrackDataSampler::~CrackDataSampler ( )
inlinevirtual

Destructor.

Definition at line 41 of file CrackDataSampler.h.

41 {}

Member Function Documentation

◆ execute()

void CrackDataSampler::execute ( )
virtual

Populates the postprocessor vector of values with the supplied postprocessors.

Definition at line 75 of file CrackDataSampler.C.

76 {
77  if (processor_id() == 0)
78  {
79  std::vector<Real> values;
80  for (unsigned int i = 0; i < _domain_integral_postprocessor_values.size(); ++i)
81  {
82  values.clear();
83  const Point * crack_front_point = _crack_front_definition->getCrackFrontPoint(i);
84  Real position;
85  if (_position_type == "Angle")
87  else
89 
90  values.push_back(*_domain_integral_postprocessor_values[i]);
91  addSample(*crack_front_point, position, values);
92  }
93  }
94 }

◆ finalize()

void CrackDataSampler::finalize ( )
virtual

Definition at line 97 of file CrackDataSampler.C.

98 {
99  SamplerBase::finalize();
100 }

◆ initialize()

void CrackDataSampler::initialize ( )
virtual

Initialize, clears the postprocessor vector.

Definition at line 61 of file CrackDataSampler.C.

62 {
65  mooseError("In CrackDataSampler, number of crack front nodes != number of domain integral "
66  "postprocessors");
68  mooseError(
69  "In CrackDataSampler, 'position_type = Angle' specified, but angle is not available. ",
70  "Must specify 'crack_mouth_boundary' in CrackFrontDefinition");
71  SamplerBase::initialize();
72 }

◆ validParams()

InputParameters CrackDataSampler::validParams ( )
static

Definition at line 19 of file CrackDataSampler.C.

20 {
21  InputParameters params = GeneralVectorPostprocessor::validParams();
22 
23  params += SamplerBase::validParams();
24 
25  params.addRequiredParam<std::vector<PostprocessorName>>(
26  "postprocessors", "The postprocessors whose values are to be reported");
27  params.addRequiredParam<UserObjectName>("crack_front_definition",
28  "The CrackFrontDefinition user object name");
29  MooseEnum position_type("Angle Distance", "Distance");
30  params.addParam<MooseEnum>(
31  "position_type",
32  position_type,
33  "The method used to calculate position along crack front. Options are: " +
34  position_type.getRawNames());
35  params.addClassDescription("Outputs the values of a set of domain integral postprocessors as a "
36  "vector, along with their positions along the crack front.");
37 
38  return params;
39 }

Member Data Documentation

◆ _crack_front_definition

const CrackFrontDefinition* const CrackDataSampler::_crack_front_definition
protected

Definition at line 56 of file CrackDataSampler.h.

Referenced by execute(), and initialize().

◆ _domain_integral_postprocessor_values

std::vector<const PostprocessorValue *> CrackDataSampler::_domain_integral_postprocessor_values
protected

The vector of PostprocessorValue objects that are used to get the values of the domain integral postprocessors.

Definition at line 61 of file CrackDataSampler.h.

Referenced by CrackDataSampler(), execute(), and initialize().

◆ _position_type

MooseEnum CrackDataSampler::_position_type
protected

Definition at line 58 of file CrackDataSampler.h.

Referenced by execute(), and initialize().


The documentation for this class was generated from the following files:
CrackFrontDefinition::hasAngleAlongFront
bool hasAngleAlongFront() const
Definition: CrackFrontDefinition.C:1102
CrackDataSampler::_position_type
MooseEnum _position_type
Definition: CrackDataSampler.h:58
CrackFrontDefinition::getCrackFrontPoint
const Point * getCrackFrontPoint(const unsigned int point_index) const
Definition: CrackFrontDefinition.C:1057
CrackFrontDefinition::getNumCrackFrontPoints
unsigned int getNumCrackFrontPoints() const
Definition: CrackFrontDefinition.C:1117
validParams
InputParameters validParams()
name
const std::string name
Definition: Setup.h:21
CrackFrontDefinition::getDistanceAlongFront
Real getDistanceAlongFront(const unsigned int point_index) const
Definition: CrackFrontDefinition.C:1096
CrackDataSampler::_crack_front_definition
const CrackFrontDefinition *const _crack_front_definition
Definition: CrackDataSampler.h:56
CrackDataSampler::_domain_integral_postprocessor_values
std::vector< const PostprocessorValue * > _domain_integral_postprocessor_values
The vector of PostprocessorValue objects that are used to get the values of the domain integral postp...
Definition: CrackDataSampler.h:61
CrackFrontDefinition::getAngleAlongFront
Real getAngleAlongFront(const unsigned int point_index) const
Definition: CrackFrontDefinition.C:1108