https://mooseframework.inl.gov
Loading...
Searching...
No Matches
xfem
test
src
postprocessors
TestCrackCounter.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
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
13
registerMooseObject
(
"XFEMTestApp"
,
TestCrackCounter
);
14
15
InputParameters
16
TestCrackCounter::validParams
()
17
{
18
InputParameters
params =
GeneralPostprocessor::validParams
();
19
params.
addClassDescription
(
20
"Test postprocessor for extracting the crack_tip_origin_direction_map from XFEM."
);
21
22
return
params;
23
}
24
25
TestCrackCounter::TestCrackCounter
(
const
InputParameters
& parameters)
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
37
TestCrackCounter::initialize
()
38
{
39
_number_of_cracks
= 0;
40
}
41
42
void
43
TestCrackCounter::execute
()
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
52
TestCrackCounter::getValue
()
const
53
{
54
return
_number_of_cracks
;
55
}
registerMooseObject
registerMooseObject("XFEMTestApp", TestCrackCounter)
TestCrackCounter.h
XFEM.h
FEProblemBase
FEProblemBase::getXFEM
std::shared_ptr< XFEMInterface > getXFEM()
GeneralPostprocessor
GeneralPostprocessor::validParams
static InputParameters validParams()
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
GeneralPostprocessor::mooseError
void mooseError(Args &&... args) const
TestCrackCounter
Definition
TestCrackCounter.h:18
TestCrackCounter::initialize
virtual void initialize() override
Initialize the number of Cracks.
Definition
TestCrackCounter.C:37
TestCrackCounter::_number_of_cracks
unsigned int _number_of_cracks
Variable used to write out the number of Cracks.
Definition
TestCrackCounter.h:35
TestCrackCounter::TestCrackCounter
TestCrackCounter(const InputParameters ¶meters)
Definition
TestCrackCounter.C:25
TestCrackCounter::validParams
static InputParameters validParams()
Definition
TestCrackCounter.C:16
TestCrackCounter::execute
virtual void execute() override
Calculates the number of Cracks.
Definition
TestCrackCounter.C:43
TestCrackCounter::getValue
virtual Real getValue() const override
Get number of Cracks.
Definition
TestCrackCounter.C:52
TestCrackCounter::_xfem
std::shared_ptr< XFEM > _xfem
Definition
TestCrackCounter.h:38
GeneralPostprocessor::_subproblem
SubProblem & _subproblem
InputParameters
Generated on Fri Aug 21 2026 13:42:04 for https://mooseframework.inl.gov by
1.9.8