18 :
mField(m_field), crackSet(crack_set), sourceBit(
source),
44 CHKERR mb.tag_get_data(
mb.globalId_tag(), &
v, 1, &id);
64 CHKERR mb.get_adjacencies(
crack, 1,
false, edges, moab::Interface::UNION);
66 for (
auto edge : subtract(edges,
skinEdges)) {
77 const EntityHandle *conn;
84 std::sort(ids.begin(), ids.end());
90 double &value)
const {
96 CHKERR mb.get_adjacencies(&node, 1, 1,
false, edges);
97 if (intersect(edges, front).
size() != 2 ||
101 std::array<double, 3> x;
102 CHKERR mb.get_coords(&node, 1, x.data());
105 const EntityHandle *conn;
107 CHKERR mb.get_connectivity(face, conn, count,
true);
108 std::array<std::array<double, 3>, 2>
d;
110 for (
int n = 0;
n != 3; ++
n)
111 if (conn[
n] != node) {
113 for (
int i = 0;
i != 3; ++
i)
117 const std::array<double, 3>
c{
d[0][1] *
d[1][2] -
d[0][2] *
d[1][1],
118 d[0][2] *
d[1][0] -
d[0][0] *
d[1][2],
119 d[0][0] *
d[1][1] -
d[0][1] *
d[1][0]};
121 std::atan2(std::sqrt(
c[0] *
c[0] +
c[1] *
c[1] +
c[2] *
c[2]),
122 d[0][0] *
d[1][0] +
d[0][1] *
d[1][1] +
d[0][2] *
d[1][2]);
124 value = 2 * M_PI - sector;
129 EntityHandle &edge)
const {
136 const EntityHandle conn[] = {
a->second, b->second};
139 moab::Interface::INTERSECT);
140 candidates = intersect(candidates, front);
141 if (candidates.size() == 1)
142 edge = candidates.front();
150 bool &changed,
Step &step) {
156 std::array<double, 3>
d;
161 EntityHandle face = 0;
163 CHKERR crack_extension.closeCrackGap(
179 report.candidatesTried == 0)
182 <<
"Edge (" << pair[0] <<
", " << pair[1]
183 <<
") has no candidate: tried " <<
report.candidatesTried
184 <<
", rejected behind/angle/move " <<
report.rejectedBehind <<
'/'
186 <<
", inversion/quality " <<
report.rejectedInversion <<
'/'
187 <<
report.rejectedQuality <<
", bridging/pocket/fixed/topology "
188 <<
report.rejectedBridging <<
'/' <<
report.rejectedPocket <<
'/'
189 <<
report.rejectedFixed <<
'/' <<
report.rejectedTopology
190 <<
", open corner/pinch " <<
report.rejectedOpenCorner <<
'/'
196 ->updateAllMeshsetsByEntitiesChildren(
outputBit);
199 Range added(face, face);
216 CHKERR mb.get_adjacencies(added, 1,
false, edges, moab::Interface::UNION);
219 step.
kind = operation;
223 step.
filled = filled.size();
238 moab::Interface::UNION);
243 std::vector<int> ids(
vertices.size());
245 const std::set<int> near(ids.begin(), ids.end());
248 it = near.count((*
it)[0]) || near.count((*
it)[1]) ?
failed->erase(
it)
262 std::vector<std::pair<double, Pair>> sharp;
263 for (
auto edge : front) {
264 const EntityHandle *conn;
270 sharp.emplace_back(std::min(
a, b),
edgeIds(edge));
272 std::sort(sharp.begin(), sharp.end());
273 std::vector<Pair> edges;
274 for (
const auto &entry : sharp)
275 edges.push_back(entry.second);
290 std::vector<EntityHandle> handles;
291 std::vector<int> ranks;
292 for (std::size_t
i = 0;
i != edges.size(); ++
i) {
296 handles.push_back(edge);
305 for (
bool gaps_only : {
true,
false}) {
307 std::vector<int> categories;
310 &categories, handles, &
selected, gaps_only);
311 for (std::size_t
i = 0;
i != handles.size(); ++
i) {
312 const auto edge = handles[
i];
313 const auto &pair = edges[ranks[
i]];
314 double opening_angle = 0;
316 const EntityHandle *conn;
318 CHKERR mb.get_connectivity(edge, conn, count,
true);
322 opening_angle = std::min(
a, b);
337 bool changed =
false;
352 bool changed =
false;
385 std::vector<char> dropped(edges.size(), 0);
387 for (std::size_t
i = 0;
i != edges.size(); ++
i) {
394 bool changed =
false;
405 <<
"Ranked edge (" << edges[
i][0] <<
", " << edges[
i][1]
406 <<
") retry at direction tolerance " <<
tolerance <<
" degrees";
420 std::vector<char> dropped(edges.size(), 0);
424 for (std::size_t
i = 0;
i != edges.size(); ++
i) {
429 bool changed =
false;
441 <<
"No front edge extends; angle tolerance " <<
tolerance
447std::vector<CGALTools::CrackExtensionSettings>
451 std::vector<CGALTools::CrackExtensionSettings> phases{flips};
456 phases.push_back(moves);
472 std::vector<char> &dropped,
473 Step &step, EntityHandle &edge) {
std::vector< std::array< EntityHandle, 3 > > faces
Sorted keys.
CGALTools::CrackExtensionCandidate candidate
MoFEM::Interface & mField
std::vector< int > source
const Settings & settings
std::vector< Face > closures
Faces closing non-convex front corners.
std::vector< int > vertices
std::unordered_map< int, NodeConstraint > constraints
std::vector< Cell > cells
Crack growth one step at a time on two bit levels, on top of CGALInterface. Not included by MoFEM....
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
virtual CrackExtension & getCrackExtension()=0
CGALTools::CrackExtensionSettings extension
bool join
Close gaps globally, then join, before advancing.
std::vector< Pair > addedEdges
Closure, extension: edges of new faces.
CGALTools::CrackExtensionCandidate candidate
Closure, extension.
std::vector< int > dropped
Extension: listed edges not on the front.
int extended
Index selected by extend or advanceOrdered.
double toleranceDegrees
Extension: the angle tolerance used.
std::vector< int > joinCategories
Join: the CGALTools::CrackJoinFace category of each face.
double opening
Closure: uncracked angle of the corner, radians.
std::size_t closures
Faces closing corners in the same step.
Pair edge
Front edge of closure, extension or ordered join.
std::size_t filled
Notch faces filled after it.
std::unordered_map< int, EntityHandle > vertexById
bool widenTolerance(double &tolerance) const
MoFEMErrorCode forgetClosuresNear(const Range &faces)
std::set< Pair > failedGapJoins
MoFEMErrorCode join(const Direction &direction, Step &step)
MoFEM::Interface & mField
std::set< Pair > failedJoins
MoFEMErrorCode refreshLevel() const
CgalCrackGrowth(MoFEM::Interface &m_field, EntityHandle crack_set, BitRefLevel source, BitRefLevel output, const Range &constraints, const Settings &settings)
std::set< Pair > failedClosures
MoFEMErrorCode resolveListed(const std::vector< Pair > &edges, std::size_t i, const Range &front, std::vector< char > &dropped, Step &step, EntityHandle &edge)
std::function< MoFEMErrorCode(EntityHandle edge, const Range &crack, std::array< double, 3 > &direction)> Direction
Extension direction of a front edge, given the crack faces.
MoFEMErrorCode extend(const std::vector< Pair > &edges, const Direction &direction, Step &step)
bool levelChanged
Skin and vertex IDs of the current level, refreshed when it changes.
MoFEMErrorCode frontEdges(const Range &crack, Range &front) const
const Settings & settings() const
MoFEMErrorCode crackFaces(Range &crack) const
MoFEMErrorCode resolve(const Pair &pair, const Range &front, EntityHandle &edge) const
Pair edgeIds(EntityHandle edge) const
MoFEMErrorCode opening(EntityHandle node, const Range &crack, const Range &front, double &value) const
std::array< int, 2 > Pair
std::vector< CGALTools::CrackExtensionSettings > advancePhases() const
MoFEMErrorCode change(Kind operation, const Pair &pair, EntityHandle edge, const Range &crack, const Direction &direction, const CGALTools::CrackExtensionSettings &settings, bool &changed, Step &step)
CGALInterface::CrackExtension & crackExtension() const
MoFEMErrorCode closeAndJoin(const std::vector< Pair > &edges, const Direction &direction, Step &step)
MoFEMErrorCode advanceOrdered(const std::vector< Pair > &edges, const Direction &direction, Step &step)
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.