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_global.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_GLOBAL
25 #define CMESH_GLOBAL
26 
36 #include "Cmesh_generate.h"
37 
38 
39 template<typename T,typename Timg>
40 class Cmesh_global : public Cmesh_generate<T,Timg>
41 {
42 
43  public:
44 
45 
46 
48  {// constructor
49 
50  this->class_name = "Cmesh_global";
51 
52  }
53 
54  virtual int assign(const Cimage<Timg> &oImage)
55  {// initialize attribute dimensions
56 
67  for (int i=0; i<this->num_var(); i++){this->m_grid.push_back(oImage.cur_dim(i));}
68 
69  this->m_node.assign(this->num_var(), 1,1,1,1, 0);
70 
72  this->m_connect.assign(1, this->m_dof);
73  if (this->m_verbose){printf("\tConnectivity table : [%i](%i)\n",this->m_connect.size(),this->m_connect[0].width());}
74 
75  this->m_win.assign(3,0);
76  this->m_pitch.assign(3,0);
77  for (int i=0; i<3; i++){this->m_win[i] = oImage.cur_dim(i); this->m_pitch[i] = oImage.cur_dim(i);}
78 
79  this->m_numPix = oImage.m_curImg[0].size();
80 
81  return 0;
82 
83  }
84 
85  virtual void set_nodes(const Cimage<Timg> &oImage, CImgList<T> &nodes)
86  {// node table definition
87 
92  cimglist_for(nodes, dim)
93  {
94  nodes[dim][0] = ((float)oImage.cur_dim(dim))/2.;
95  }
96 
97  }
98 
99  virtual void set_connectivity(const Cimage<Timg> &oImage, const CImgList<T> &nodes, CImgList<int> &elements)
100  {// element and connectivity table definition
101 
106  cimg_forX(elements[0],nd)
107  {
108  elements[0][nd] = nd;
109  }
110 
111  }
112 
113  virtual int grid_dims(const int &i) const
114  {
115 
116  switch(i)
117  {
118  case 0: return this->m_grid[0]; break;
119  case 1: return this->m_grid[1]; break;
120  case 2:
121  if (this->_3D)
122  {return this->m_grid[2];}
123  else
124  {1;}
125  break;
126  case 3: return 1; break;
127  default:
128  {
129  std::cerr<<this->class_name<<"::"<<__func__<<": error: id="<<i<<" which is over [0-3]\n"<<std::flush;
130  return 0;
131  }
132  }
133 
134  }
135 
136 
137 };
138 
139 #endif
virtual void set_connectivity(const Cimage< Timg > &oImage, const CImgList< T > &nodes, CImgList< int > &elements)
Definition: Cmesh_global.h:99
Definition: Cmesh_generate.h:43
virtual void set_nodes(const Cimage< Timg > &oImage, CImgList< T > &nodes)
Definition: Cmesh_global.h:85
virtual int assign(const Cimage< Timg > &oImage)
Definition: Cmesh_global.h:54
Definition: Cmesh_global.h:40
Definition: Cimage.h:57