NLMech  0.1.0
fracture.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef GEOM_FRACTURE_H
10 #define GEOM_FRACTURE_H
11 
12 #include "util/point.h" // definition of Point3
13 #include <inp/decks/fractureDeck.h>
14 #include <stdint.h> // uint8_t type
15 #include <string.h> // size_t type
16 #include <vector>
17 
18 // forward declaration of fracture deck
19 namespace inp {
20 struct EdgeCrack;
21 struct FractureDeck;
22 } // namespace inp
23 
25 namespace geometry {
26 
31 class Fracture {
32 
33 public:
40  Fracture(inp::FractureDeck *deck, const std::vector<util::Point3> *nodes,
41  const std::vector<std::vector<size_t>> *neighbor_list);
42 
47  explicit Fracture(inp::FractureDeck *deck);
48 
56  bool addCrack(const double &time, const std::vector<util::Point3> *nodes,
57  const std::vector<std::vector<size_t>> *neighbor_list);
58 
66  void setBondState(const size_t &i, const size_t &j, const bool &state);
67 
75  bool getBondState(const size_t &i, const size_t &j) const;
76 
83  std::vector<uint8_t> getBonds(const size_t &i) const;
84 
94  std::string printStr(int nt = 0, int lvl = 0) const;
95 
103  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
104 
105 private:
114  void computeFracturedBondFd(const size_t &i, inp::EdgeCrack *crack,
115  const std::vector<util::Point3> *nodes,
116  const std::vector<size_t> *neighbors);
117 
120 
128  std::vector<std::vector<uint8_t>> d_fracture;
129 };
130 
131 } // namespace geometry
132 
133 #endif // GEOM_FRACTURE_H
A class for fracture state of bonds.
Definition: fracture.h:31
Fracture(inp::FractureDeck *deck, const std::vector< util::Point3 > *nodes, const std::vector< std::vector< size_t >> *neighbor_list)
Constructor.
Definition: fracture.cpp:20
void setBondState(const size_t &i, const size_t &j, const bool &state)
Sets the bond state.
Definition: fracture.cpp:162
bool addCrack(const double &time, const std::vector< util::Point3 > *nodes, const std::vector< std::vector< size_t >> *neighbor_list)
Sets fracture state according to the crack data.
Definition: fracture.cpp:45
void computeFracturedBondFd(const size_t &i, inp::EdgeCrack *crack, const std::vector< util::Point3 > *nodes, const std::vector< size_t > *neighbors)
Sets state of bond which intersect the pre-crack line as fractured.
Definition: fracture.cpp:74
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: fracture.h:103
std::vector< std::vector< uint8_t > > d_fracture
Vector which stores the state of bonds.
Definition: fracture.h:128
std::vector< uint8_t > getBonds(const size_t &i) const
Returns the list of bonds of node i.
Definition: fracture.cpp:189
inp::FractureDeck * d_fractureDeck_p
Interior flags deck.
Definition: fracture.h:119
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: fracture.cpp:193
bool getBondState(const size_t &i, const size_t &j) const
Read bond state.
Definition: fracture.cpp:174
Collection of methods and data related to geometry.
Definition: DataManager.h:23
Collection of methods and database related to input.
Definition: main.cpp:21
A structure to edge crack of any orientation.
Definition: fractureDeck.h:22
Structure to read and store fracture related input data.
Definition: fractureDeck.h:227