www.mooseframework.org
TestCrackCounter.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "TestCrackCounter.h"
11 #include "XFEM.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<GeneralPostprocessor>();
20  params.addClassDescription(
21  "Test postprocessor for extracting the crack_tip_origin_direction_map from XFEM.");
22 
23  return params;
24 }
25 
26 TestCrackCounter::TestCrackCounter(const InputParameters & parameters)
27  : GeneralPostprocessor(parameters), _number_of_cracks(0)
28 {
29  FEProblemBase * fe_problem = dynamic_cast<FEProblemBase *>(&_subproblem);
30  if (fe_problem == nullptr)
31  mooseError("Problem casting _subproblem to FEProblemBase in TestCrackCounter");
32  _xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(fe_problem->getXFEM());
33  if (_xfem == nullptr)
34  mooseError("Problem casting to XFEM in TestCrackCounter");
35 }
36 
37 void
39 {
41 }
42 
43 void
45 {
46  const std::map<const Elem *, std::vector<Point>> & crack_origins_map =
47  _xfem->getCrackTipOriginMap();
48 
49  _number_of_cracks = crack_origins_map.size();
50 }
51 
52 Real
54 {
55  return _number_of_cracks;
56 }
registerMooseObject
registerMooseObject("XFEMTestApp", TestCrackCounter)
TestCrackCounter::TestCrackCounter
TestCrackCounter(const InputParameters &parameters)
Definition: TestCrackCounter.C:26
TestCrackCounter::initialize
virtual void initialize()
Initialize the number of Cracks.
Definition: TestCrackCounter.C:38
TestCrackCounter
Definition: TestCrackCounter.h:21
TestCrackCounter::getValue
virtual Real getValue()
Get number of Cracks.
Definition: TestCrackCounter.C:53
validParams< TestCrackCounter >
InputParameters validParams< TestCrackCounter >()
Definition: TestCrackCounter.C:17
TestCrackCounter::_number_of_cracks
unsigned int _number_of_cracks
Variable used to write out the number of Cracks.
Definition: TestCrackCounter.h:37
TestCrackCounter.h
TestCrackCounter::_xfem
std::shared_ptr< XFEM > _xfem
Definition: TestCrackCounter.h:40
XFEM.h
TestCrackCounter::execute
virtual void execute()
Calculates the number of Cracks.
Definition: TestCrackCounter.C:44