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
Cfield_intercor.h
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 CFIELD_INTERCOR
25 #define CFIELD_INTERCOR
26 
27 
28 //-----------------------------CIMG_NETCDF-------------------------------
29 #define cimg_plugin "plugins/add_fileformat.h"
30 #define cimg_use_netcdf
31 
32 #ifdef cimg_use_netcdf
33  #include "../NetCDF.Tool/struct_parameter_NetCDF.h"
34 // #define cimg_plugin1 "plugins/netcdf_file_format4CImg1.h"
35 // #define cimglist_plugin1 "plugins/netcdf_file_format4CImgList1.h"
36  #define cimg_plugin2 "plugins/netcdf_file_format4CImg2.h"
37  #define cimglist_plugin2 "plugins/netcdf_file_format4CImgList2.h"
38  #include "../CImg.Tool/CImg_NetCDF.h"
39 #endif
40 //-----------------------------CIMG_NETCDF-------------------------------
41 
42 #include "Cfield_opticalFlow_fem.h"
43 
44 
45 template<typename T, typename Timg>
47 {
48 
49 
50  public:
51 
53  {// constructor
54 
55  this->class_name = "Field : Inter-correlation";
56 
57  }
58 
59 
60  virtual void init(CParameterNetCDF &fp)
61  {// init from parameter file
62 
63  std::string attribute_name = "store_correlogram";
64  int error = fp.loadAttribute(attribute_name,this->m_storeCorrelo);
65  if (this->m_verbose and this->m_storeCorrelo){printf("\t\t Correlograms are stored\n");}
66 
67  }
68 
69 
70  virtual void exec(const Cimage<Timg> &oImage, const Cmesh<T,Timg> &oMesh, CImgList<T> &modes_prev, CshapeFunction<T,Timg> &oShape_prev, const std::vector<T> &ref_prev, const CImgList<T> &nodes_prev)
71  {
73  if (this->m_storeCorrelo){this->m_correlogram.assign(oImage.cur_dim(0), oImage.cur_dim(1), oImage.cur_dim(2), oImage.cur_dim(3), 0);}
74 
76  this->m_mode.assign(oMesh.num_var()+2, oMesh.grid_dims(0),oMesh.grid_dims(1),oMesh.grid_dims(2),1, 0);
77 
78  Cfield<T,Timg>::exec(oImage, oMesh, modes_prev, oShape_prev, ref_prev, nodes_prev);
79 
80  }
81 
82 
83 
84  virtual void project(const Cmesh<T,Timg> &oMesh, const Cimage<Timg> &oImage, CImgList<T> &modes_prev, CshapeFunction<T,Timg> &oShape_prev, const std::vector<T> &ref_prev, const CImgList<T> &nodes_prev, CImgList<T> &modes_cur)
85  {//project modes on new base
86 
87 
88  if ((oShape_prev.m_name).compare(0,5,"OFFEM") == 0)
89  {//basic linear interpolation from previous the current grid of modes [U, V, W]
90 
91 
92  CImgList<T> U(oMesh.num_var(), modes_prev[0].width(), modes_prev[0].height(), modes_prev[0].depth(), 1, 0);
93 
94  this->Field2Field(modes_prev, U);
95 
96  cimglist_for(U, mode)
97  {modes_cur[mode+2] = U[mode];}
98 
99 
100  }
101  else if((oShape_prev.m_name).compare(0,2,"IC") == 0)
102  {//basic linear interpolation from previous the current grid of modes [U, V, W]
103 
104  this->Field2Field(modes_prev, modes_cur);
105 
106  }
107  else if((oShape_prev.m_name).compare(0,4,"OFIB") == 0)
108  {//basic linear interpolation from previous the current grid and building of U, V and W at previous element centroid
109 
111  CImgList<T> U0(oMesh.num_var(), modes_prev[0].width(), modes_prev[0].height(), modes_prev[0].depth(), 1, 0);
112  CImgList<T> U1(oMesh.num_var(), modes_cur[0].width(), modes_cur[0].height(), modes_cur[0].depth(), 1, 0);
113 
114  this->OFIBU(oMesh, oImage, oShape_prev, ref_prev, nodes_prev, modes_prev, U0);
115 
116  this->Field2Field(U0, U1);
117 
118  cimglist_for(U1, mode)
119  {modes_cur[mode+2] = U1[mode];}
120 
121 
122  }
123  else if((oShape_prev.m_name).compare(0,3,"OFI") == 0)
124  {
125 
126  CImgList<T> U(oMesh.num_var(), modes_cur[0].width(), modes_cur[0].height(), modes_cur[0].depth(), 1, 0);
127 
128  this->OFIU(oMesh, oImage, oShape_prev, ref_prev, nodes_prev, modes_prev, U);
129 
130  cimglist_for(U, mode)
131  {modes_cur[mode+2] = U[mode];}
132 
133  }
134  else{printf("unknown name for previous correlation method");}
135 
136  }
137 
138 
139 
140 };
141 
142 #endif
In this class, specific projection field method is implemented. In the case of F.E.M. the node value is equal to the field at node position, so "fromField2Mod" simply implements a parallelized loop over elements and extracts from previous fields the node value at node location.
Definition: Cfield_opticalFlow_fem.h:49
virtual void project(const Cmesh< T, Timg > &oMesh, const Cimage< Timg > &oImage, CImgList< T > &modes_prev, CshapeFunction< T, Timg > &oShape_prev, const std::vector< T > &ref_prev, const CImgList< T > &nodes_prev, CImgList< T > &modes_cur)
Definition: Cfield_intercor.h:84
virtual void exec(const Cimage< Timg > &oImage, const Cmesh< T, Timg > &oMesh, CImgList< T > &modes_prev, CshapeFunction< T, Timg > &oShape_prev, const std::vector< T > &ref_prev, const CImgList< T > &nodes_prev)
Definition: Cfield.h:100
This is the mother class of shape function objets (virtual pure).
Definition: CshapeFunction.h:48
virtual void exec(const Cimage< Timg > &oImage, const Cmesh< T, Timg > &oMesh, CImgList< T > &modes_prev, CshapeFunction< T, Timg > &oShape_prev, const std::vector< T > &ref_prev, const CImgList< T > &nodes_prev)
Definition: Cfield_intercor.h:70
CImg< T > m_correlogram
to improve, they shouldn't be here//
Definition: Cfield.h:74
Definition: Cmesh.h:61
Definition: Cfield_intercor.h:46
Definition: Cimage.h:57