24 #ifndef CMESH_GENERATE_CENTROID_INTEGRATED
25 #define CMESH_GENERATE_CENTROID_INTEGRATED
54 template<
typename T,
typename Timg>
65 this->class_name =
"Cmesh_generate_centroid_integrated";
79 error = fp.loadAttribute(att,this->m_win);
80 for (
int i=this->m_win.size(); i<3; i++){this->m_win.push_back(1);}
81 if (this->m_verbose){printf(
"\tMesh ZOI : [%i %i %i]\n",this->m_win[0], this->m_win[1], this->m_win[2]);}
83 m_mode_num = this->m_dof;
87 virtual int cropList(
const Cimage<Timg> &oImage,
const int &elem, CImg<Timg> &list, std::vector<T> &coord0)
const
94 std::vector<T> coord1;
95 coord0.assign(3,0);coord1.assign(3,0);
97 double unmasked(num_mod()*num_mod());
99 cimglist_for(this->m_node, dim)
102 coord0[dim] = this->m_node[dim][this->m_connect[elem].front()] - this->m_win[dim]/2 + 1;
103 coord1[dim] = this->m_node[dim][this->m_connect[elem].front()] - this->m_win[dim]/2 + this->m_win[dim] - 1;
110 if (coord1[dim] >= oImage.cur_dim(dim)-1)
112 coord1[dim] = oImage.cur_dim(dim) - 2;
117 if (!oImage.m_curMask.is_empty())
119 unmasked = oImage.m_curMask.get_crop(coord0[0],coord0[1],coord0[2],0,coord1[0],coord1[1],coord1[2],0,0).sum();
123 if (unmasked >= num_mod()*2)
124 {list.assign(coord1[0]-coord0[0]+1, coord1[1]-coord0[1]+1, coord1[2]-coord0[2]+1, 1, 0);}
132 virtual int grid_dims(
const int &i)
const
137 case 0:
return this->m_grid[0];
break;
138 case 1:
return this->m_grid[1];
break;
139 case 2:
return this->m_grid[2];
break;
140 case 3:
return 1;
break;
143 std::cerr<<this->class_name<<
"::"<<__func__<<
": error: id="<<i<<
" which is over [0-3]\n"<<std::flush;
150 virtual int num_mod()
const
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
As Cmesh_Q4 this class is based on regular and rectangular elements. This class works on 7 main attri...
Definition: Cmesh_generate_centroid_integrated.h:55
Cmesh_generate_centroid_integrated()
Definition: Cmesh_generate_centroid_integrated.h:62
virtual int cropList(const Cimage< Timg > &oImage, const int &elem, CImg< Timg > &list, std::vector< T > &coord0) const
Definition: Cmesh_generate_centroid_integrated.h:87
virtual int get_attributes(CParameterNetCDF &fp)
Definition: Cmesh_generate_centroid_integrated.h:69
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