/////////////////////////////////////
// get_visibility()
/////////////////////////////////////
void
HatchingGroupFixed::get_visibility(TAGformat &d)
{
   err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::get_visibility()"); 

   BMESHptr m = _patch->mesh();
   LMESHptr lm = dynamic_pointer_cast<LMESH>(m);
   if (lm)
      m = lm->cur_mesh();

   vector<int>::size_type k;
   int ctr=0;
   vector<int> indices;
   CBface_list& faces = m->faces();

   *d >> indices;

   for (k=0; k<indices.size(); k++) {
      HatchingSimplexDataFixed *hsdf =
         HatchingSimplexDataFixed::find(faces[indices[k]]);
      if (!hsdf) {
         hsdf = new HatchingSimplexDataFixed(faces[indices[k]]);
         ctr++;
      }
      hsdf->add(this);
   }

   err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::get_visibility() - Flagged %d tris and added %d new simplex data.", indices.size(), ctr);
}
/////////////////////////////////////
// put_visibility()
/////////////////////////////////////
void
HatchingGroupFixed::put_visibility(TAGformat &d) const
{
   err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility()"); 

   BMESHptr m = _patch->mesh();
   LMESHptr lm = dynamic_pointer_cast<LMESH>(m);
   if (lm)
      m = lm->cur_mesh();

   Bface_list::size_type k;
   vector<int> indices;
   CBface_list& faces = m->faces();
        
   for (k=0; k< faces.size(); k++) {
      HatchingSimplexDataFixed *hsdf = HatchingSimplexDataFixed::find(faces[k]);
      if (hsdf) {
         if (hsdf->exists(this))
            indices.push_back(faces[k]->index());
      }
   }
   err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility() - Stored %d tri indices.", indices.size());

   d.id();
   *d << indices;
   d.end_id();
}