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
Cmesh_generate_centroid.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 CMESH_GENERATE_CENTROID
25 #define CMESH_GENERATE_CENTROID
26 
38 
57 template<typename T,typename Timg>
59 {
60 
61  public:
62 
63  int m_peaks;
64 
66  {// constructor
67 
68  this->class_name = "Cmesh_generate_centroid";
69 
70  }
71 
72  virtual int get_attributes(CParameterNetCDF &fp)
73  {// correlation window size and the desired peak number loading
74 
75  // load components
77 
78  int error(0);
79  std::string att;
80 
81  //m_win[x,y,z]
82  att = "window";
83  error = fp.loadAttribute(att,this->m_win);
84  for (int i=this->m_win.size(); i<3; i++){this->m_win.push_back(1);}
85  if (this->m_verbose){printf("\tMesh ZOI : [%i %i %i]\n",this->m_win[0], this->m_win[1], this->m_win[2]);}
86 
87  //m_peaks
88  att = "store_peak";
89  error = fp.loadAttribute(att,m_peaks);
90  if (this->m_verbose){printf("\tNumber of peak : %i\n",m_peaks);}
91 
92  }
93 
94  virtual int assign(const Cimage<Timg> &oImage)
95  {// initialize attribute dimensions
96 
100  this->m_dof = 1;
101  this->m_grid.assign(3,1);
102  for (int i=0; i<this->num_var(); i++)
103  {
104  this->m_grid[i] = (int)ceil((float)oImage.cur_dim(i)/(float)this->m_pitch[i])+1;
105  this->m_dof *= this->m_grid[i];
106  }
107  this->m_dof *= this->num_var();
108  if (this->m_verbose){printf("\tDegree Of Freedom : %i\n",this->m_dof);}
109 
110  this->m_node.assign(this->num_var(), this->m_grid[0],this->m_grid[1],this->m_grid[2],1, 0);
111  if (this->m_verbose){printf("\tNode table : [%i](%i,%i,%i)\n",this->m_node.size(), this->m_node[0].width(), this->m_node[0].height(), this->m_node[0].depth());}
112 
113  if (this->_3D)
114  {
115  this->m_connect.assign((this->m_grid[0]-1)*(this->m_grid[1]-1)*(this->m_grid[2]-1), 1,1,1,1, 0);
116  }
117  else
118  {
119  this->m_connect.assign((this->m_grid[0]-1)*(this->m_grid[1]-1), 1,1,1,1, 0);
120  }
121  if (this->m_verbose){printf("\tElement table [%i](%i)\n",this->m_connect.size(), this->m_connect[0].width());}
122 
123  this->m_numPix = this->m_win[0]*this->m_win[1]*this->m_win[2]*this->m_connect.size();
124 
125  return 0;
126 
127  }
128 
129  virtual void set_connectivity(const Cimage<Timg> &oImage, const CImgList<T> &nodes, CImgList<int> &elements)
130  {// element and connectivity table definition
131 
136  #pragma omp for schedule(runtime)
137  cimglist_for(elements, elem)
138  {//fill element table
139 
140  elements[elem][0] = elem;
141 
142  }
143 
144  }
145 
146  virtual int grid_dims(const int &i) const
147  {// return mesh grid dimensions
148 
149  switch(i)
150  {
151  case 0: return this->m_grid[0]; break;
152  case 1: return this->m_grid[1]; break;
153  case 2: return this->m_grid[2]; break;
154  case 3: return m_peaks; break;
155  default:
156  {
157  std::cerr<<this->class_name<<"::"<<__func__<<": error: id="<<i<<" which is over [0-3]\n"<<std::flush;
158  return 0;
159  }
160  }
161 
162  }
163 
164 
165 };
166 
167 #endif
As Cmesh_Q4 this class is based on regular and rectangular elements. This class works on 7 main attri...
Definition: Cmesh_generate_centroid.h:58
virtual int assign(const Cimage< Timg > &oImage)
Definition: Cmesh_generate_centroid.h:94
Class is based on Q4 elements, i.e. 4 nodes elements. This class works on 7 main attributes declared ...
Definition: Cmesh_generate_regularFem.h:52
virtual void set_connectivity(const Cimage< Timg > &oImage, const CImgList< T > &nodes, CImgList< int > &elements)
Definition: Cmesh_generate_centroid.h:129
Definition: Cimage.h:57