YaDICs  V04.14.a
Yet another Digital Image Correlation software: platform dedicated to 2/3D Fluid and Solid kinematics field measurements.
 All Classes Files Functions Variables Pages
CshapeFunction_global_brasilian.h
Go to the documentation of this file.
1 /**********************************************************************
2  * Copyright (C) 2012, The YaDICs Project Developers.
3  * See the COPYRIGHT file at the top-level directory of this distribution ./COPYRIGHT.
4  * See ./COPYING file for copying and redistribution conditions.
5  *
6  * This file is part of YaDICs.
7  * YaDICs is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * YaDICs is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with YaDICs. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Information about how to use the software are provided at http://yadic.univ-lille1.fr/
21  **********************************************************************/
22 
23 
24 #ifndef CSHAPEFUNCTION_GLOBAL_BRASILIAN
25 #define CSHAPEFUNCTION_GLOBAL_BRASILIAN
26 
36 
45 template<typename T,typename Timg>
47 {
48 
49  public:
50 
51  std::vector<int> m_modB;//Required Brasilian mode
52  double m_nu, m_r;//Poisson, radius
53  std::vector<double> m_f;//force
54  double m_k0, m_k1;//parameters function of m_nu, m_f and m_r
55 
57  {// constructor
58 
59  this->class_name = "CshapeFunction_global_brasilian";
60 
61  }
62 
63  virtual void init(CParameterNetCDF &fp)
64  {//fill m_modB vector with the indice of required Brasilian mode from parameter.nc
65 
66  //look for the Homogeneous Deformation set of required modes.
68 
69  //identify the Brasilian mode withins this->m_mods[] and store it within m_modB[]
70  m_modB.clear();
72  for (int i=0; i<this->m_mods.size(); i++){if (this->m_mods[i].compare(0,1,"B") == 0){m_modB.push_back(i);}}
73  if (this->m_verbose){std::cout<<"\tmodes B : [ ";for (int i=0; i<m_modB.size(); i++){std::cout<<m_modB[i]<<" ";}std::cout<<"]\n";}
74 
75  std::string att_name("Poisson");
76  fp.loadAttribute(att_name,m_nu);
77  if (this->m_verbose){std::cout<<"\tPoisson factor : "<<m_nu<<"\n";}
78 
79  att_name = "radius";
80  fp.loadAttribute(att_name,m_r);
81  if (this->m_verbose){std::cout<<"\tCircle radius : "<<m_r<<"\n";}
82 
83  att_name = "force";
84  fp.loadAttribute(att_name,m_f);
85  if (this->m_verbose){std::cout<<"\tforce : "<<m_f[frame_number]<<"\n";}
86 
88  m_k0 = (m_f[frame_number]*m_r*(1+m_nu))/(2*this->m_pi);
89  m_k1 = (3-m_nu)/(1+m_nu);
90 
91  }
92 
93  virtual void exec(const CImg<Timg> &box, const std::vector<T> &x, CImgList<T> &N)
94  {// assign CImgList<T> N[dimensions][modes] for required Brasilian and HD modes at coordonate (x,y,z)
95 
96  //fill HD modes
98 
103  double a, b, xx, yy;
104 
105  //90° rotation of the reference system (Z* = Z x i)
106  xx=-x[1];
107  yy=x[0];
108 
109  a = m_r + xx;
110  b = m_r - xx;
111 
112  if ((a==0 or b==0) and yy==0)
113  {// two points are singular : (-m_r,0) and (m_r,0)
114  if (this->m_verbose){printf("\nwarning singular points\n");}
115  }
116  else
117  {
118  //fill Brasilian mode
119  for (int mode=0; mode<m_modB.size(); mode++)
120  {
121  N[1][m_modB[mode]] = m_k0*( m_k1*(a/m_r - std::log(std::sqrt(std::pow(a,2)+std::pow(yy,2))/std::sqrt(std::pow(b,2)+std::pow(yy,2)))) + std::log(std::sqrt(std::pow(a,2)+std::pow(yy,2))/std::sqrt(std::pow(b,2)+std::pow(yy,2))) + (std::pow(a,2)-std::pow(yy,2))/(std::pow(a,2)+std::pow(yy,2)) + (std::pow(b,2)-std::pow(yy,2))/(std::pow(b,2)+std::pow(yy,2)) - xx/m_r);
122 
123  N[0][m_modB[mode]] = m_k0*( m_k1*(yy/m_r - std::atan2(yy,b) - std::atan2(yy,a)) - std::atan2(yy,b) + (2*yy*a)/(std::pow(a,2)+std::pow(yy,2)) - (2*yy*b)/(std::pow(b,2)+std::pow(yy,2)) - yy/m_r - std::atan2(yy,a));
124  }
125 
126  }
127 
128  }
129 
130 };
131 
132 #endif
This class implements Homogeneous deformation shape functions available for 2D and 3D cases...
Definition: CshapeFunction_global_homogeneous.h:41
virtual void init(CParameterNetCDF &fp)
Definition: CshapeFunction_global_homogeneous.h:56
This class implements Brasilian shape functions available for 2D case (isotropic elasticity). The implemented mode is called "B" and a link toward Homogeneous modes is provided. Brasilian mode within the entire set of required modes by user is noted "m_modB" and the identified parameter is 1/E with E the Young modulus:
Definition: CshapeFunction_global_brasilian.h:46
virtual void exec(const CImg< Timg > &box, const std::vector< T > &x, CImgList< T > &N)
Definition: CshapeFunction_global_brasilian.h:93
virtual void init(CParameterNetCDF &fp)
Definition: CshapeFunction_global_brasilian.h:63