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 
17 {
19  params.addClassDescription(
20  "Test postprocessor for extracting the crack_tip_origin_direction_map from XFEM.");
21 
22  return params;
23 }
24 
26  : GeneralPostprocessor(parameters), _number_of_cracks(0)
27 {
28  FEProblemBase * fe_problem = dynamic_cast<FEProblemBase *>(&_subproblem);
29  if (fe_problem == nullptr)
30  mooseError("Problem casting _subproblem to FEProblemBase in TestCrackCounter");
31  _xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(fe_problem->getXFEM());
32  if (_xfem == nullptr)
33  mooseError("Problem casting to XFEM in TestCrackCounter");
34 }
35 
36 void
38 {
40 }
41 
42 void
44 {
45  const std::map<const Elem *, std::vector<Point>> & crack_origins_map =
46  _xfem->getCrackTipOriginMap();
47 
48  _number_of_cracks = crack_origins_map.size();
49 }
50 
51 Real
53 {
54  return _number_of_cracks;
55 }
std::shared_ptr< XFEM > _xfem
virtual Real getValue() const override
Get number of Cracks.
This is the XFEM class.
Definition: XFEM.h:107
SubProblem & _subproblem
static InputParameters validParams()
static InputParameters validParams()
virtual void execute() override
Calculates the number of Cracks.
TestCrackCounter(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::shared_ptr< XFEMInterface > getXFEM()
void mooseError(Args &&... args) const
registerMooseObject("XFEMTestApp", TestCrackCounter)
virtual void initialize() override
Initialize the number of Cracks.
void addClassDescription(const std::string &doc_string)
unsigned int _number_of_cracks
Variable used to write out the number of Cracks.