Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
GlidePlaneFactory.cpp
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_GlidePlaneFactory_cpp_
9#define model_GlidePlaneFactory_cpp_
10
11#include <GlidePlaneFactory.h>
12#include <GlidePlane.h>
13
14#include <algorithm>
15#include <map>
16#include <tuple>
17#include <memory> // std::shared_ptr (c++11)
18
19#include <Eigen/Dense>
20#include <Eigen/Cholesky>
21
22#include <SimplicialMesh.h>
24#include <LatticeModule.h>
25#include <ReciprocalLatticeDirection.h>
27#include <MeshPlane.h>
28#include <CRTP.h>
29#include <TypeTraits.h>
30#include <Polycrystal.h>
31#include <WeakPtrFactories.h>
32#include <GlidePlaneKey.h>
33
34namespace model
35{
36
37 template<int dim>
39 /* init */ poly(poly_in)
40 {
41
42 }
43
44 template<int dim>
49
50 template<int dim>
55
56 template<int dim>
58 const MeshPlaneType* const p2)
59 {/*@param[in] p1 first plane
60 *@param[in] p2 second plane
61 *\returns the infinite line of interseciton between the two planes,
62 * if already computed. Otherwise it computes the interseciton, stores it,
63 * and returns it.
64 */
65 const auto key=std::make_pair(std::max(p1->sID,p2->sID),std::min(p1->sID,p2->sID));
66 const auto iter=glidePlaneIntersections().find(key);
67 if(iter==glidePlaneIntersections().end())
68 {
69 const bool success(glidePlaneIntersections().emplace(std::piecewise_construct,
70 std::make_tuple(key),
71 std::make_tuple(p1->P,p1->unitNormal,p2->P,p2->unitNormal)
72 ).second);
73 if(!success)
74 {
75 throw std::runtime_error("GlidePlaneFactory::glidePlaneIntersection not found.");
76 }
77 }
78 return glidePlaneIntersections().at(key);
79 }
80
81 template<int dim>
86
87 template<int dim>
89 {
90 return *this;
91 }
92
93template struct GlidePlaneFactory<3>;
94
95}
96#endif
97
98
99
KeyConstructableWeakPtrFactory< GlidePlaneFactory< dim >, GlidePlaneType > GlidePlaneMapType
MeshPlane< dim > MeshPlaneType
PlanePlaneIntersection< dim > PlanePlaneIntersectionType
GlidePlaneFactory(const Polycrystal< dim > &poly_in)
GlidePlaneMapType & glidePlanes()
const PlanePlaneIntersectionType & glidePlaneIntersection(const MeshPlaneType *const p1, const MeshPlaneType *const p2)
MeshPlaneIntersectionContainerType & glidePlaneIntersections()
const Polycrystal< dim > & poly
std::map< std::pair< size_t, size_t >, PlanePlaneIntersectionType > MeshPlaneIntersectionContainerType
vertex p2
int end[2]
vertex p1
enum insertvertexresult success
newbad key