24 #ifndef CMESH_IMPORT_IMAGE
25 #define CMESH_IMPORT_IMAGE
41 template<
typename T,
typename Timg>
48 CImgList<unsigned int> m_list;
54 this->class_name =
"Cmesh_import_image";
63 m_list.assign(m_map.max());
68 m_map.sort(permut_map,
true);
69 int val(m_map[0]),pos(0);
71 for (
int p=0;p<m_map.size(); p++)
76 cimg_set.assign(set.size(),1,1,1,0);
77 cimg_forX(cimg_set,x){cimg_set[x]=set[x];}
78 m_list[pos] = cimg_set;
84 set.push_back(permut_map[p]);
87 m_list.remove(pos,m_map.max()-1);
90 int error = assign(oImage);
119 virtual void load(
const std::string &path)
122 m_map.load(path.c_str());
130 this->m_dof = m_map.max();
131 if (this->m_verbose){printf(
"\tDegree Of Freedom : %i\n",this->m_dof);}
134 this->m_node.assign(this->num_var(),m_map.max(),1,1,1,0);
135 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());}
138 this->m_connect.assign(m_map.max(),1,1,1,1,0);
140 if (this->m_verbose){printf(
"\tElement table : [%i](%i,%i,%i)\n",this->m_connect.size(), this->m_connect[0].width(), this->m_connect[0].height(), this->m_connect[0].depth());}
143 this->m_numPix = oImage.m_curImg[0].size();
149 virtual void set_nodes(
const Cimage<Timg> &oImage, CImgList<T> &nodes)
156 virtual void set_connectivity(
const Cimage<Timg> &oImage,
const CImgList<T> &nodes, CImgList<int> &elements)
162 virtual int cropList(
const Cimage<Timg> &oImage,
const int &elem, CImg<Timg> &list, std::vector<T> &coord0)
const
178 virtual int grid_dims(
const int &i)
const
183 case 0:
return this->m_node[0].width();
break;
184 case 1:
return this->m_node[0].height();
break;
185 case 2:
return this->m_node[0].depth();
break;
186 case 3:
return 1;
break;
189 std::cerr<<this->class_name<<
"::"<<__func__<<
": error: id="<<i<<
" which is over [0-3]\n"<<std::flush;
Definition: Cmesh_import_image.h:42
Definition: Cmesh_import.h:42
virtual int cropList(const Cimage< Timg > &oImage, const int &elem, CImg< Timg > &list, std::vector< T > &coord0) const
Definition: Cmesh_import_image.h:162