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() {}
 
const dal::bit_vector & convex_index() const
Return the list of valid convex IDs.
 
pconvex_structure structure_of_convex(size_type ic) const
Return the pconvex_structure of the convex ic.
 
void clear(void)
Clear and desallocate all the elements.
 
static T & instance()
Instance from the current thread.
 
bool context_check() const
return true if update_from_context was called
 
Describe an integration method linked to a mesh.
 
void write_to_file(std::ostream &ost) const
Write the mesh_im to a stream.
 
virtual pintegration_method int_method_of_element(size_type cv) const
return the integration method associated with an element (in no integration is associated,...
 
void update_from_context(void) const
this function has to be defined and should update the object when the context is modified.
 
const mesh & linked_mesh() const
Give a reference to the linked mesh of type mesh.
 
void set_auto_add(pintegration_method pim)
Set the im for automatic addition of element option.
 
const dal::bit_vector & convex_index(void) const
Get the set of convexes where an integration method has been assigned.
 
void read_from_file(std::istream &ist)
Read the mesh_im from a stream.
 
void set_integration_method(size_type cv, pintegration_method pim)
Set the integration method of a convex.
 
void write_to_file(const std::string &name) const
Write the mesh to a file.
 
gmm::uint64_type convex_version_number(size_type ic) const
return the version number of the convex ic.
 
Define the getfem::mesh_im class (integration of getfem::mesh_fem).
 
std::string name_of_geometric_trans(pgeometric_trans p)
Get the string name of a geometric transformation.
 
int get_token(std::istream &ist, std::string &st, bool ignore_cr, bool to_up, bool read_un_pm, int *linenb)
Very simple lexical analysis of general interest for reading small languages with a "MATLAB like" syn...
 
size_t size_type
used as the common size type in the library
 
pconvex_structure basic_structure(pconvex_structure cv)
Original structure (if concerned)
 
GEneric Tool for Finite Element Methods.
 
std::string name_of_int_method(pintegration_method p)
Get the string name of an integration method .
 
pintegration_method classical_approx_im(bgeot::pgeometric_trans pgt, dim_type degree)
try to find an approximate integration method for the geometric transformation pgt which is able to i...
 
const mesh_im & dummy_mesh_im()
Dummy mesh_im for default parameter of functions.
 
pintegration_method int_method_descriptor(std::string name, bool throw_if_not_found=true)
Get an integration method from its name .