Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
SecondPhase.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
9#ifndef model_SecondPhase_cpp_
10#define model_SecondPhase_cpp_
11
12#include <memory>
13//#include <LatticePlaneBase.h>
14//#include <LatticeVector.h>
15//#include <RationalLatticeDirection.h>
16#include <SecondPhase.h>
17#include <TerminalColors.h>
18
19namespace model
20{
21
22 template<int dim>
23 SecondPhase<dim>::SecondPhase(const std::string& _name,
24 const std::map<const GlidePlaneBase*,std::shared_ptr<GammaSurface>>& _gsMap,
25 const PlaneNormalContainerType& planes_in) :
26 /* init */ name(_name)
27 /* init */,gsMap(_gsMap)
28 /* init */,planes(planes_in)
29 {
30
31 std::cout<<greenBoldColor<<"Creating SecondPhase "<<name<<", phaseID= "<<this->sID<<defaultColor<<std::endl;
32
33 }
34
35 template<int dim>
36 double SecondPhase<dim>::misfitEnergy(const VectorDim& b,const GlidePlaneBase* const gpb) const
37 {
38 const auto gammaIter(gsMap.find(gpb));
39 if(gammaIter!=gsMap.end())
40 {
41 const VectorDim bL(gpb->G2L*b);
42 if(std::fabs(bL(2))>FLT_EPSILON)
43 {
44 throw std::runtime_error("SLIP VECTOR NOT ON GlidePlaneBase");
45 }
46 return gammaIter->second->operator()(bL.template segment<2>(0));
47 }
48 else
49 {
50 return 0.0;
51 }
52
53 }
54
55template<int dim>
56double SecondPhase<dim>::misfitEnergy(const VectorDim& b,const size_t& planeID) const
57{
58 return misfitEnergy(b,planes.at(planeID).get());
59}
60
61template<int dim>
62std::shared_ptr<GammaSurface> SecondPhase<dim>::gammaSurface(const size_t& planeID) const
63{
64 return gsMap.at(planes.at(planeID).get());
65}
66
67template struct SecondPhase<3>;
68}
69#endif
b
Definition int_R.m:16
static std::string greenBoldColor
static std::string defaultColor
const Eigen::Matrix3d G2L
const std::string name
Definition SecondPhase.h:29
std::shared_ptr< GammaSurface > gammaSurface(const size_t &) const
const PlaneNormalContainerType & planes
Definition SecondPhase.h:31
SecondPhase(const std::string &, const std::map< const GlidePlaneBase *, std::shared_ptr< GammaSurface > > &, const PlaneNormalContainerType &)
const Eigen::Matrix< double, dim, 1 > VectorDim
Definition SecondPhase.h:26
const std::map< const GlidePlaneBase *, std::shared_ptr< GammaSurface > > gsMap
Definition SecondPhase.h:30
double misfitEnergy(const VectorDim &s, const GlidePlaneBase *const gpb) const
std::map< size_t, std::shared_ptr< GlidePlaneBase > > PlaneNormalContainerType
Definition SecondPhase.h:27