28 for (dal::bv_visitor i(im_convexes); !i.finished(); ++i) {
30 if (v_num_update < linked_mesh_->convex_version_number(i))
38 if (!im_convexes.is_in(i)
40 if (auto_add_elt_pim != 0)
45 v_num_update = v_num = act_counter();
50 GMM_ASSERT1(linked_mesh_ != 0,
"Uninitialized mesh_im");
53 {
if (im_convexes.is_in(cv))
54 { im_convexes.sup(cv); touch(); v_num = act_counter(); } }
55 else if (!im_convexes.is_in(cv) || ims[cv] != pim) {
57 (pim->type() == IM_NONE ||
59 == *key_of_stored_object(pim->structure()),
60 "Incompatibility between integration method "
65 touch(); v_num = act_counter();
70 pintegration_method pim) {
71 for (dal::bv_visitor cv(cvs); !cv.finished(); ++cv)
82 GMM_ASSERT1(im_degree != dim_type(-1),
"im_degree==-1");
83 for (dal::bv_visitor cv(cvs); !cv.finished(); ++cv) {
84 pintegration_method pim =
91 GMM_ASSERT1(im_degree != dim_type(-1),
"im_degree==-1");
94 !cv.finished(); ++cv, ++i) {
95 pintegration_method pim =
102 if (pim != auto_add_elt_pim) auto_add_elt_pim = 0;
107 void mesh_im::clear(
void) {
108 ims.
clear(); im_convexes.clear();
109 touch(); v_num = act_counter();
113 void mesh_im::init_with_mesh(
const mesh &me) {
114 GMM_ASSERT1(linked_mesh_ == 0,
"Mesh im already initialized");
116 this->add_dependency(me);
117 auto_add_elt_pim = 0;
118 v_num_update = v_num = act_counter();
122 linked_mesh_ = 0; auto_add_elt_pim = 0;
123 is_lower_dim =
false;
124 v_num_update = v_num = act_counter();
127 void mesh_im::copy_from(
const mesh_im &mim) {
128 clear_dependencies();
130 init_with_mesh(*(mim.linked_mesh_));
131 is_lower_dim = mim.is_lower_dim;
132 im_convexes = mim.im_convexes;
133 v_num_update = mim.v_num_update;
136 auto_add_elt_pim = mim.auto_add_elt_pim;
139 mesh_im::mesh_im(
const mesh_im &mim) : context_dependencies() {
140 linked_mesh_ = 0; copy_from(mim);
143 mesh_im &mesh_im::operator=(
const mesh_im &mim) {
148 mesh_im::mesh_im(
const mesh &me)
149 { linked_mesh_ = 0; init_with_mesh(me); is_lower_dim =
false; }
151 mesh_im::~mesh_im() {}
155 GMM_ASSERT1(linked_mesh_ != 0,
"Uninitialized mesh_im");
156 gmm::stream_standard_locale sl(ist);
162 ist.seekg(0);ist.clear();
163 bgeot::read_until(ist,
"BEGIN MESH_IM");
168 if (bgeot::casecmp(tmp,
"END")==0) {
170 }
else if (bgeot::casecmp(tmp,
"CONVEX")==0) {
174 " does not exist, are you sure "
175 "that the mesh attached to this object is right one ?");
180 while (!isspace(c)) { tmp.push_back(c); ist.get(c); }
183 GMM_ASSERT1(pfi,
"could not create the integration method '"
187 }
else if (tmp.size()) {
188 GMM_ASSERT1(
false,
"Unexpected token '" << tmp <<
189 "' [pos=" << std::streamoff(ist.tellg()) <<
"]");
190 }
else if (ist.eof()) {
191 GMM_ASSERT1(
false,
"Unexpected end of stream "
192 <<
"(missing BEGIN MESH_IM/END MESH_IM ?)");
199 std::ifstream o(name.c_str());
200 GMM_ASSERT1(o,
"mesh_im file '" << name <<
"' does not exist");
207 gmm::stream_standard_locale sl(ost);
208 ost <<
'\n' <<
"BEGIN MESH_IM" <<
'\n' <<
'\n';
209 for (dal::bv_visitor cv(
convex_index()); !cv.finished(); ++cv) {
210 ost <<
" CONVEX " << cv;
215 ost <<
"END MESH_IM" <<
'\n';
220 std::ofstream o(name.c_str());
221 GMM_ASSERT1(o,
"impossible to open file '" << name <<
"'");
222 o <<
"% GETFEM MESH_IM FILE " <<
'\n';
223 o <<
"% GETFEM VERSION " << GETFEM_VERSION <<
'\n' <<
'\n' <<
'\n';
229 struct dummy_mesh_im_ {
231 dummy_mesh_im_() : mim() {}