v0.16.3
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MoFEM::CgalCrackGrowth Struct Reference

#include "src/interfaces/CgalCrackGrowth.hpp"

Collaboration diagram for MoFEM::CgalCrackGrowth:
[legend]

Classes

struct  Settings
 
struct  Step
 

Public Types

enum class  Kind { None , Join , Closure , Extension }
 
using Pair = std::array< int, 2 >
 
using Direction = std::function< MoFEMErrorCode(EntityHandle edge, const Range &crack, std::array< double, 3 > &direction)>
 Extension direction of a front edge, given the crack faces.
 

Public Member Functions

 CgalCrackGrowth (MoFEM::Interface &m_field, EntityHandle crack_set, BitRefLevel source, BitRefLevel output, const Range &constraints, const Settings &settings)
 
BitRefLevel level () const
 The level holding the current mesh.
 
const Settings & settings () const
 
MoFEMErrorCode crackFaces (Range &crack) const
 
MoFEMErrorCode frontEdges (const Range &crack, Range &front) const
 
Pair edgeIds (EntityHandle edge) const
 
MoFEMErrorCode opening (EntityHandle node, const Range &crack, const Range &front, double &value) const
 
MoFEMErrorCode join (const Direction &direction, Step &step)
 
MoFEMErrorCode extend (const std::vector< Pair > &edges, const Direction &direction, Step &step)
 
MoFEMErrorCode advanceOrdered (const std::vector< Pair > &edges, const Direction &direction, Step &step)
 

Private Member Functions

MoFEMErrorCode refreshLevel () const
 
MoFEMErrorCode closeAndJoin (const std::vector< Pair > &edges, const Direction &direction, Step &step)
 
MoFEMErrorCode forgetClosuresNear (const Range &faces)
 
MoFEMErrorCode resolve (const Pair &pair, const Range &front, EntityHandle &edge) const
 
MoFEMErrorCode resolveListed (const std::vector< Pair > &edges, std::size_t i, const Range &front, std::vector< char > &dropped, Step &step, EntityHandle &edge)
 
CGALInterface::CrackExtension & crackExtension () const
 
std::vector< CGALTools::CrackExtensionSettings > advancePhases () const
 
bool widenTolerance (double &tolerance) const
 
MoFEMErrorCode change (Kind operation, const Pair &pair, EntityHandle edge, const Range &crack, const Direction &direction, const CGALTools::CrackExtensionSettings &settings, bool &changed, Step &step)
 

Private Attributes

MoFEM::Interface & mField
 
EntityHandle crackSet
 
BitRefLevel sourceBit
 
BitRefLevel outputBit
 
Range constraints
 
Settings options
 
bool levelChanged = true
 Skin and vertex IDs of the current level, refreshed when it changes.
 
Range skinEdges
 
Range skinVertices
 
std::unordered_map< int, EntityHandle > vertexById
 
std::set< Pair > failedClosures
 
std::set< Pair > failedGapJoins
 
std::set< Pair > failedJoins
 

Detailed Description

Crack growth by steps. A step joins the front to the existing crack, closes a gap whose closing face is missing, or extends one front edge. A closure or an extension publishes the mesh on the other bit level, fills notches, retires the old level and swaps the two levels. The caller chooses the extension direction of a front edge and the order in which front edges are tried. One rank. See doc/development/cgal_crack_extension_algorithm.md.

Definition at line 22 of file CgalCrackGrowth.hpp.

Member Typedef Documentation

◆ Direction

using MoFEM::CgalCrackGrowth::Direction = std::function<MoFEMErrorCode( EntityHandle edge, const Range &crack, std::array<double, 3> &direction)>

Extension direction of a front edge, given the crack faces.

Definition at line 27 of file CgalCrackGrowth.hpp.

◆ Pair

using MoFEM::CgalCrackGrowth::Pair = std::array<int, 2>

A front edge by the sorted GLOBAL_IDs of its vertices; stable when levels are swapped and retired entities are deleted.

Definition at line 25 of file CgalCrackGrowth.hpp.

Member Enumeration Documentation

◆ Kind

enum class MoFEM::CgalCrackGrowth::Kind
strong
Enumerator
None 
Join 
Closure 
Extension 

Definition at line 39 of file CgalCrackGrowth.hpp.

Constructor & Destructor Documentation

◆ CgalCrackGrowth()

MoFEM::CgalCrackGrowth::CgalCrackGrowth ( MoFEM::Interface &  m_field,
EntityHandle  crack_set,
BitRefLevel  source,
BitRefLevel  output,
const Range &  constraints,
const Settings &  settings 
)

crack_set holds the crack faces on source; constraints are protected as in CGALInterface::CrackExtension::extendCrack.

Definition at line 14 of file CgalCrackGrowth.cpp.

18 : mField(m_field), crackSet(crack_set), sourceBit(source),
21}
std::vector< int > source
CGALTools::CrackExtensionSettings extension
bool join
Close gaps globally, then join, before advancing.
MoFEM::Interface & mField
const Settings & settings() const

Member Function Documentation

◆ advanceOrdered()

MoFEMErrorCode MoFEM::CgalCrackGrowth::advanceOrdered ( const std::vector< Pair > &  edges,
const Direction &  direction,
Step &  step 
)

Global gap closure, then global joining, then flip-only advance, then vertex movement. Supplied edge priority is respected within each phase; each edge exhausts its allowed tolerance range before the next. Flips may recover both missing gap and joining faces.

Definition at line 373 of file CgalCrackGrowth.cpp.

375 {
377 CGALInterface::CrackExtension::SearchCacheScope cache(crackExtension());
378 CHKERR closeAndJoin(edges, direction, step);
379 if (step.kind != Kind::None)
381 step = Step();
382 Range crack, front;
384 CHKERR frontEdges(crack, front);
385 std::vector<char> dropped(edges.size(), 0);
386 for (auto settings : advancePhases())
387 for (std::size_t i = 0; i != edges.size(); ++i) {
388 EntityHandle edge;
389 CHKERR resolveListed(edges, i, front, dropped, step, edge);
390 if (!edge)
391 continue;
393 settings.angleToleranceDegrees = tolerance;
394 bool changed = false;
395 CHKERR change(Kind::Extension, edges[i], edge, crack, direction,
396 settings, changed, step);
397 if (changed) {
398 step.extended = i;
399 step.toleranceDegrees = tolerance;
401 }
403 break;
404 MOFEM_LOG("WORLD", Sev::verbose)
405 << "Ranked edge (" << edges[i][0] << ", " << edges[i][1]
406 << ") retry at direction tolerance " << tolerance << " degrees";
407 }
408 }
410}
Range crackFaces
FaceSet crack
double tolerance
Radians.
#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 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.
FTensor::Index< 'i', SPACE_DIM > i
double angleToleranceDegrees
Accepted angle between candidate face and target plane.
bool widenTolerance(double &tolerance) const
MoFEMErrorCode resolveListed(const std::vector< Pair > &edges, std::size_t i, const Range &front, std::vector< char > &dropped, Step &step, EntityHandle &edge)
MoFEMErrorCode frontEdges(const Range &crack, Range &front) const
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)

◆ advancePhases()

std::vector< CGALTools::CrackExtensionSettings > MoFEM::CgalCrackGrowth::advancePhases ( ) const
private

Settings of the advance phases: flips alone first, then, when moves are allowed, the move classes only.

Definition at line 448 of file CgalCrackGrowth.cpp.

448 {
449 auto flips = options.extension;
450 flips.maxMoveRelative = 0;
451 std::vector<CGALTools::CrackExtensionSettings> phases{flips};
453 // Flips alone already failed for every edge at every tolerance.
454 auto moves = options.extension;
455 moves.skipFlips = true;
456 phases.push_back(moves);
457 }
458 return phases;
459}
double maxMoveRelative
Move bound, fraction of mean edge length at the free node.

◆ change()

MoFEMErrorCode MoFEM::CgalCrackGrowth::change ( Kind  operation,
const Pair &  pair,
EntityHandle  edge,
const Range &  crack,
const Direction &  direction,
const CGALTools::CrackExtensionSettings &  settings,
bool &  changed,
Step &  step 
)
private

Close a gap at, or extend, one front edge; on success publish, fill, retire and swap levels, and describe it in step.

Definition at line 147 of file CgalCrackGrowth.cpp.

150 {
152 changed = false;
153 auto bridge = mField.getInterface<CGALInterface>();
154 auto &crack_extension = bridge->getCrackExtension();
155 auto &mb = mField.get_moab();
156 std::array<double, 3> d;
157 CHKERR direction(edge, crack, d);
158 CGALTools::CrackExtensionCandidate candidate;
159 CGALTools::CrackExtensionReport report;
160 Range entities, closures;
161 EntityHandle face = 0;
162 if (operation == Kind::Closure)
163 CHKERR crack_extension.closeCrackGap(
165 entities, face, &candidate, &report, &closures);
166 else if (operation == Kind::Join)
167 CHKERR crack_extension.joinCrack(sourceBit, outputBit, crack, constraints,
168 {{edge, d}}, settings, entities, face,
170 else
171 CHKERR crack_extension.extendCrack(sourceBit, outputBit, crack, constraints,
172 {{edge, d}}, settings, entities, face,
174 if (!face) {
175 // Only an empty structural target set is independent of the caller's
176 // direction. Angle-dependent joining failures must be retried when a
177 // mechanics solve changes the requested direction.
178 if (operation == Kind::Join && !settings.joinGapsOnly &&
179 report.candidatesTried == 0)
180 failedJoins.insert(pair);
181 MOFEM_LOG("WORLD", Sev::verbose)
182 << "Edge (" << pair[0] << ", " << pair[1]
183 << ") has no candidate: tried " << report.candidatesTried
184 << ", rejected behind/angle/move " << report.rejectedBehind << '/'
185 << report.rejectedAngle << '/' << report.rejectedMove
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 << '/'
191 << report.rejectedPinch;
193 }
194 changed = true;
195 CHKERR mField.getInterface<MeshsetsManager>()
196 ->updateAllMeshsetsByEntitiesChildren(outputBit);
197 CHKERR mb.add_entities(crackSet, &face, 1);
198 CHKERR mb.add_entities(crackSet, closures);
199 Range added(face, face);
200 added.merge(closures);
201 Range filled;
202 if (options.fill) {
203 Range current;
204 CHKERR crackFaces(current);
205 CHKERR crack_extension.crackFill(outputBit, current, constraints, filled);
206 CHKERR mb.add_entities(crackSet, filled);
207 added.merge(filled);
208 }
209 CHKERR bridge->retireLevel(sourceBit);
210 // Entity deletion retags the shared channel; restore it.
211 MOFEM_LOG_CHANNEL("WORLD");
212 std::swap(sourceBit, outputBit);
213 levelChanged = true;
215 Range edges;
216 CHKERR mb.get_adjacencies(added, 1, false, edges, moab::Interface::UNION);
217 for (auto e : edges)
218 step.addedEdges.push_back(edgeIds(e));
219 step.kind = operation;
220 step.edge = pair;
221 step.candidate = candidate;
222 step.closures = closures.size();
223 step.filled = filled.size();
225}
CGALTools::CrackExtensionCandidate candidate
Report & report
std::vector< Face > closures
Faces closing non-convex front corners.
moab::Interface & mb
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode forgetClosuresNear(const Range &faces)
std::set< Pair > failedJoins
bool levelChanged
Skin and vertex IDs of the current level, refreshed when it changes.
Pair edgeIds(EntityHandle edge) const
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ closeAndJoin()

MoFEMErrorCode MoFEM::CgalCrackGrowth::closeAndJoin ( const std::vector< Pair > &  edges,
const Direction &  direction,
Step &  step 
)
private

Global gap-closure pass followed by joining, ordered by edges within each operation. Both passes can recover missing faces by flips.

Definition at line 280 of file CgalCrackGrowth.cpp.

282 {
284 step = Step();
285 if (!options.join)
287 Range crack, front;
289 CHKERR frontEdges(crack, front);
290 std::vector<EntityHandle> handles;
291 std::vector<int> ranks;
292 for (std::size_t i = 0; i != edges.size(); ++i) {
293 EntityHandle edge;
294 CHKERR resolve(edges[i], front, edge);
295 if (edge) {
296 handles.push_back(edge);
297 ranks.push_back(i);
298 } else
299 step.dropped.push_back(i);
300 }
301 if (handles.empty())
303 auto &mb = mField.get_moab();
304 auto &bridge = crackExtension();
305 for (bool gaps_only : {true, false}) {
306 Range existing;
307 std::vector<int> categories;
308 EntityHandle selected = 0;
309 CHKERR bridge.crackJoin(sourceBit, crack, constraints, existing,
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;
315 if (gaps_only) {
316 const EntityHandle *conn;
317 int count;
318 CHKERR mb.get_connectivity(edge, conn, count, true);
319 double a, b;
320 CHKERR opening(conn[0], crack, front, a);
321 CHKERR opening(conn[1], crack, front, b);
322 opening_angle = std::min(a, b);
323 }
324 if (edge == selected) {
325 CHKERR mb.add_entities(crackSet, existing);
326 CHKERR forgetClosuresNear(existing);
327 step.kind = gaps_only ? Kind::Closure : Kind::Join;
328 step.joinCategories = std::move(categories);
329 step.edge = pair;
330 step.extended = ranks[i];
331 step.opening = opening_angle;
333 }
335 settings.joinGapsOnly = gaps_only;
336 if (gaps_only && !failedClosures.count(pair)) {
337 bool changed = false;
338 CHKERR change(Kind::Closure, pair, edge, crack, direction, settings,
339 changed, step);
340 if (changed) {
341 step.extended = ranks[i];
342 step.opening = opening_angle;
344 }
345 failedClosures.insert(pair);
346 }
347 auto &failed = gaps_only ? failedGapJoins : failedJoins;
348 if (failed.count(pair))
349 continue;
350 for (double tolerance = settings.angleToleranceDegrees;;) {
351 settings.angleToleranceDegrees = tolerance;
352 bool changed = false;
353 CHKERR change(Kind::Join, pair, edge, crack, direction, settings,
354 changed, step);
355 if (changed) {
356 if (gaps_only)
357 step.kind = Kind::Closure;
358 step.extended = ranks[i];
359 step.opening = opening_angle;
360 step.toleranceDegrees = tolerance;
362 }
363 if (gaps_only || failedJoins.count(pair) || !widenTolerance(tolerance))
364 break;
365 }
366 if (gaps_only)
367 failed.insert(pair);
368 }
369 }
371}
bool selected
Definition CGALTools.cpp:97
bool failed
constexpr double a
std::set< Pair > failedGapJoins
std::set< Pair > failedClosures
MoFEMErrorCode resolve(const Pair &pair, const Range &front, EntityHandle &edge) const
MoFEMErrorCode opening(EntityHandle node, const Range &crack, const Range &front, double &value) const

◆ crackExtension()

CGALInterface::CrackExtension & MoFEM::CgalCrackGrowth::crackExtension ( ) const
inlineprivate

Definition at line 131 of file CgalCrackGrowth.hpp.

131 {
132 return mField.getInterface<CGALInterface>()->getCrackExtension();
133 }

◆ crackFaces()

MoFEMErrorCode MoFEM::CgalCrackGrowth::crackFaces ( Range &  crack) const

Definition at line 51 of file CgalCrackGrowth.cpp.

51 {
53 crack.clear();
54 CHKERR mField.get_moab().get_entities_by_type(crackSet, MBTRI, crack, true);
56}

◆ edgeIds()

CgalCrackGrowth::Pair MoFEM::CgalCrackGrowth::edgeIds ( EntityHandle  edge) const

Definition at line 75 of file CgalCrackGrowth.cpp.

75 {
76 auto &mb = mField.get_moab();
77 const EntityHandle *conn;
78 int count;
79 Pair ids;
80 CHK_MOAB_THROW(mb.get_connectivity(edge, conn, count, true),
81 "edge connectivity");
82 CHK_MOAB_THROW(mb.tag_get_data(mb.globalId_tag(), conn, 2, ids.data()),
83 "edge IDs");
84 std::sort(ids.begin(), ids.end());
85 return ids;
86}
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
std::array< int, 2 > Pair

◆ extend()

MoFEMErrorCode MoFEM::CgalCrackGrowth::extend ( const std::vector< Pair > &  edges,
const Direction &  direction,
Step &  step 
)

Try flip-only advances on the whole list over the allowed tolerance range, then allow vertex movement. Within a pass, preserve FIFO edge and tolerance order. This method omits the separate global gap/join passes.

Definition at line 412 of file CgalCrackGrowth.cpp.

413 {
415 CGALInterface::CrackExtension::SearchCacheScope cache(crackExtension());
416 step = Step();
417 Range crack, front;
419 CHKERR frontEdges(crack, front);
420 std::vector<char> dropped(edges.size(), 0);
421 for (auto settings : advancePhases())
422 for (double tolerance = options.extension.angleToleranceDegrees;;) {
423 settings.angleToleranceDegrees = tolerance;
424 for (std::size_t i = 0; i != edges.size(); ++i) {
425 EntityHandle edge;
426 CHKERR resolveListed(edges, i, front, dropped, step, edge);
427 if (!edge)
428 continue;
429 bool changed = false;
430 CHKERR change(Kind::Extension, edges[i], edge, crack, direction,
431 settings, changed, step);
432 if (changed) {
433 step.extended = i;
434 step.toleranceDegrees = tolerance;
436 }
437 }
439 break;
440 MOFEM_LOG("WORLD", Sev::verbose)
441 << "No front edge extends; angle tolerance " << tolerance
442 << " degrees";
443 }
445}

◆ forgetClosuresNear()

MoFEMErrorCode MoFEM::CgalCrackGrowth::forgetClosuresNear ( const Range &  faces)
private

Forget failed closures within twice the ring limit of the nodes of faces: a closure search changes cells within the ring limit of its edge, so a change there may make it possible.

Definition at line 227 of file CgalCrackGrowth.cpp.

227 {
229 if (failedClosures.empty() && failedGapJoins.empty() && failedJoins.empty())
231 auto &mb = mField.get_moab();
232 auto bits = mField.getInterface<BitRefManager>();
234 CHKERR mb.get_connectivity(faces, vertices, true);
235 for (int r = 0; r != 2 * options.extension.ringLimit; ++r) {
236 Range cells;
237 CHKERR mb.get_adjacencies(vertices, 3, false, cells,
238 moab::Interface::UNION);
239 CHKERR bits->filterEntitiesByRefLevel(sourceBit, BitRefLevel().set(),
240 cells);
241 CHKERR mb.get_connectivity(cells, vertices, true);
242 }
243 std::vector<int> ids(vertices.size());
244 CHKERR mb.tag_get_data(mb.globalId_tag(), vertices, ids.data());
245 const std::set<int> near(ids.begin(), ids.end());
247 for (auto it = failed->begin(); it != failed->end();)
248 it = near.count((*it)[0]) || near.count((*it)[1]) ? failed->erase(it)
249 : std::next(it);
251}
std::vector< std::array< EntityHandle, 3 > > faces
Sorted keys.
std::vector< int > vertices
std::vector< Cell > cells
It it
Definition Schur.cpp:2568
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
int r
Definition sdf.py:205
int ringLimit
Vertex rings around the front edge that may change.

◆ frontEdges()

MoFEMErrorCode MoFEM::CgalCrackGrowth::frontEdges ( const Range &  crack,
Range &  front 
) const

Crack edges with one crack face that are not on the body skin.

Definition at line 58 of file CgalCrackGrowth.cpp.

59 {
62 auto &mb = mField.get_moab();
63 Range edges;
64 CHKERR mb.get_adjacencies(crack, 1, false, edges, moab::Interface::UNION);
65 front.clear();
66 for (auto edge : subtract(edges, skinEdges)) {
68 CHKERR mb.get_adjacencies(&edge, 1, 2, false, faces);
69 if (intersect(faces, crack).size() == 1)
70 front.insert(edge);
71 }
73}
std::vector< int > size
MoFEMErrorCode refreshLevel() const

◆ join()

MoFEMErrorCode MoFEM::CgalCrackGrowth::join ( const Direction &  direction,
Step &  step 
)

Close a feasible gap anywhere on the front before joining anywhere. Sharpness orders edges within each phase. Missing faces are recovered by flips; neither phase moves vertices. None when joining is disabled or no gap or join is admissible.

Definition at line 253 of file CgalCrackGrowth.cpp.

253 {
255 step = Step();
256 if (!options.join)
258 CGALInterface::CrackExtension::SearchCacheScope cache(crackExtension());
259 Range crack, front;
261 CHKERR frontEdges(crack, front);
262 std::vector<std::pair<double, Pair>> sharp;
263 for (auto edge : front) {
264 const EntityHandle *conn;
265 int count;
266 CHKERR mField.get_moab().get_connectivity(edge, conn, count, true);
267 double a, b;
268 CHKERR opening(conn[0], crack, front, a);
269 CHKERR opening(conn[1], crack, front, b);
270 sharp.emplace_back(std::min(a, b), edgeIds(edge));
271 }
272 std::sort(sharp.begin(), sharp.end());
273 std::vector<Pair> edges;
274 for (const auto &entry : sharp)
275 edges.push_back(entry.second);
276 CHKERR closeAndJoin(edges, direction, step);
278}

◆ level()

BitRefLevel MoFEM::CgalCrackGrowth::level ( ) const
inline

The level holding the current mesh.

Definition at line 64 of file CgalCrackGrowth.hpp.

64{ return sourceBit; }

◆ opening()

MoFEMErrorCode MoFEM::CgalCrackGrowth::opening ( EntityHandle  node,
const Range &  crack,
const Range &  front,
double &  value 
) const

Uncracked opening at a front node: 2 pi minus the sum of the angles of its crack faces. A node on the body skin, or without exactly two front edges, is neutral (pi).

Definition at line 88 of file CgalCrackGrowth.cpp.

90 {
93 auto &mb = mField.get_moab();
94 value = M_PI;
95 Range edges, faces;
96 CHKERR mb.get_adjacencies(&node, 1, 1, false, edges);
97 if (intersect(edges, front).size() != 2 ||
98 skinVertices.find(node) != skinVertices.end())
100 CHKERR mb.get_adjacencies(&node, 1, 2, false, faces);
101 std::array<double, 3> x;
102 CHKERR mb.get_coords(&node, 1, x.data());
103 double sector = 0;
104 for (auto face : intersect(faces, crack)) {
105 const EntityHandle *conn;
106 int count;
107 CHKERR mb.get_connectivity(face, conn, count, true);
108 std::array<std::array<double, 3>, 2> d;
109 int k = 0;
110 for (int n = 0; n != 3; ++n)
111 if (conn[n] != node) {
112 CHKERR mb.get_coords(&conn[n], 1, d[k].data());
113 for (int i = 0; i != 3; ++i)
114 d[k][i] -= x[i];
115 ++k;
116 }
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]};
120 sector +=
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]);
123 }
124 value = 2 * M_PI - sector;
126}
const double c
speed of light (cm/ns)
FTensor::Index< 'k', 3 > k

◆ refreshLevel()

MoFEMErrorCode MoFEM::CgalCrackGrowth::refreshLevel ( ) const
private

Definition at line 23 of file CgalCrackGrowth.cpp.

23 {
25 if (!levelChanged)
27 auto &mb = mField.get_moab();
28 auto bits = mField.getInterface<BitRefManager>();
30 CHKERR bits->getEntitiesByTypeAndRefLevel(sourceBit, BitRefLevel().set(),
31 MBTET, cells);
32 Skinner skinner(&mb);
33 CHKERR skinner.find_skin(0, cells, false, skin);
34 skinEdges.clear();
35 CHKERR mb.get_adjacencies(skin, 1, false, skinEdges, moab::Interface::UNION);
36 skinVertices.clear();
37 CHKERR mb.get_connectivity(skinEdges, skinVertices, true);
39 CHKERR bits->getEntitiesByTypeAndRefLevel(sourceBit, BitRefLevel().set(),
40 MBVERTEX, vertices);
41 vertexById.clear();
42 for (auto v : vertices) {
43 int id;
44 CHKERR mb.tag_get_data(mb.globalId_tag(), &v, 1, &id);
45 vertexById[id] = v;
46 }
47 levelChanged = false;
49}
FaceSet skin
const double v
phase velocity of light in medium (cm/ns)
std::unordered_map< int, EntityHandle > vertexById

◆ resolve()

MoFEMErrorCode MoFEM::CgalCrackGrowth::resolve ( const Pair &  pair,
const Range &  front,
EntityHandle &  edge 
) const
private

The current front edge of pair, or zero.

Definition at line 128 of file CgalCrackGrowth.cpp.

129 {
132 edge = 0;
133 const auto a = vertexById.find(pair[0]), b = vertexById.find(pair[1]);
134 if (a == vertexById.end() || b == vertexById.end())
136 const EntityHandle conn[] = {a->second, b->second};
137 Range candidates;
138 CHKERR mField.get_moab().get_adjacencies(conn, 2, 1, false, candidates,
139 moab::Interface::INTERSECT);
140 candidates = intersect(candidates, front);
141 if (candidates.size() == 1)
142 edge = candidates.front();
144}

◆ resolveListed()

MoFEMErrorCode MoFEM::CgalCrackGrowth::resolveListed ( const std::vector< Pair > &  edges,
std::size_t  i,
const Range &  front,
std::vector< char > &  dropped,
Step &  step,
EntityHandle &  edge 
)
private

The current front edge of edges[i], or zero. An edge no longer on the front is marked in dropped and recorded in step.dropped once.

Definition at line 469 of file CgalCrackGrowth.cpp.

473 {
475 edge = 0;
476 if (dropped[i])
478 CHKERR resolve(edges[i], front, edge);
479 if (!edge) {
480 dropped[i] = 1;
481 step.dropped.push_back(i);
482 }
484}

◆ settings()

const Settings & MoFEM::CgalCrackGrowth::settings ( ) const
inline

Definition at line 65 of file CgalCrackGrowth.hpp.

65{ return options; }

◆ widenTolerance()

bool MoFEM::CgalCrackGrowth::widenTolerance ( double &  tolerance) const
private

Double tolerance up to Settings::angleMaxDegrees; false when it is already there or relaxation is disabled.

Definition at line 461 of file CgalCrackGrowth.cpp.

461 {
464 return false;
466 return true;
467}

Member Data Documentation

◆ constraints

Range MoFEM::CgalCrackGrowth::constraints
private

Definition at line 100 of file CgalCrackGrowth.hpp.

◆ crackSet

EntityHandle MoFEM::CgalCrackGrowth::crackSet
private

Definition at line 98 of file CgalCrackGrowth.hpp.

◆ failedClosures

std::set<Pair> MoFEM::CgalCrackGrowth::failedClosures
private

Front edges whose gap closure failed. An entry is forgotten when a step changes the mesh or the crack near it, see forgetClosuresNear.

Definition at line 111 of file CgalCrackGrowth.hpp.

◆ failedGapJoins

std::set<Pair> MoFEM::CgalCrackGrowth::failedGapJoins
private

Definition at line 112 of file CgalCrackGrowth.hpp.

◆ failedJoins

std::set<Pair> MoFEM::CgalCrackGrowth::failedJoins
private

Definition at line 112 of file CgalCrackGrowth.hpp.

◆ levelChanged

bool MoFEM::CgalCrackGrowth::levelChanged = true
mutableprivate

Skin and vertex IDs of the current level, refreshed when it changes.

Definition at line 104 of file CgalCrackGrowth.hpp.

◆ mField

MoFEM::Interface& MoFEM::CgalCrackGrowth::mField
private

Definition at line 97 of file CgalCrackGrowth.hpp.

◆ options

Settings MoFEM::CgalCrackGrowth::options
private

Definition at line 101 of file CgalCrackGrowth.hpp.

◆ outputBit

BitRefLevel MoFEM::CgalCrackGrowth::outputBit
private

Definition at line 99 of file CgalCrackGrowth.hpp.

◆ skinEdges

Range MoFEM::CgalCrackGrowth::skinEdges
mutableprivate

Definition at line 105 of file CgalCrackGrowth.hpp.

◆ skinVertices

Range MoFEM::CgalCrackGrowth::skinVertices
private

Definition at line 105 of file CgalCrackGrowth.hpp.

◆ sourceBit

BitRefLevel MoFEM::CgalCrackGrowth::sourceBit
private

Definition at line 99 of file CgalCrackGrowth.hpp.

◆ vertexById

std::unordered_map<int, EntityHandle> MoFEM::CgalCrackGrowth::vertexById
mutableprivate

Definition at line 106 of file CgalCrackGrowth.hpp.


The documentation for this struct was generated from the following files: