Skip to content
Snippets Groups Projects
Select Git revision
  • 682c97c3fb3b03d265d1a16b6dc1d6ab6cb38af0
  • master default protected
  • hierarchical-basis
  • revert-ef4a3a4f
  • patch_releases_4_14
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
41 results

ghostRegion.h

Blame
  • ghostRegion.h 3.43 KiB
    // Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    
    #ifndef _GHOST_REGION_H_
    #define _GHOST_REGION_H_
    
    #include "GModel.h"
    #include "discreteRegion.h"
    #include "MTetrahedron.h"
    #include "MHexahedron.h"
    #include "MPrism.h"
    #include "MPyramid.h"
    #include "MTrihedron.h"
    #include "MElementCut.h"
    
    class ghostRegion : public discreteRegion {
     private:
      unsigned int _partitions;
      std::map<MElement*, unsigned int> _ghostCells;
      bool _saveMesh;
      bool _haveMesh;
     public:
      ghostRegion(GModel *model, const int num, const unsigned int partitions)
      : discreteRegion(model, num), _partitions(partitions), _ghostCells(),
        _saveMesh(false), _haveMesh(false) {}
      virtual ~ghostRegion()
      {
        if(!_haveMesh){
          tetrahedra.clear();
          hexahedra.clear();
          prisms.clear();
          pyramids.clear();
          trihedra.clear();
          polyhedra.clear();
          mesh_vertices.clear();
        }
      }
      virtual GeomType geomType() const { return GhostVolume; }
      virtual void setPartition(const unsigned int partitions) { _partitions = partitions; }
      virtual unsigned int getPartition() const { return _partitions; }
      bool saveMesh() const { return _saveMesh; }
      void saveMesh(bool saveMesh) { _saveMesh = saveMesh; }
      bool haveMesh() const { return _haveMesh; }
      void haveMesh(bool haveMesh) { _haveMesh = haveMesh; }
      virtual std::map<MElement*, unsigned int> &getGhostCells() { return _ghostCells; }
      
      void addTetrahedron(MTetrahedron *t, unsigned int onWhichPartition)
      {
        GRegion::addTetrahedron(t);
        _ghostCells.insert(std::pair<MElement*, unsigned int>(t,onWhichPartition));
        model()->addGhostCells(t,onWhichPartition);
      }
      void addHexahedron(MHexahedron *h, unsigned int onWhichPartition)
      {
        GRegion::addHexahedron(h);
        _ghostCells.insert(std::pair<MElement*, unsigned int>(h,onWhichPartition));
        model()->addGhostCells(h,onWhichPartition);
      }
      void addPrism(MPrism *p, unsigned int onWhichPartition)
      {
        GRegion::addPrism(p);
        _ghostCells.insert(std::pair<MElement*, unsigned int>(p,onWhichPartition));
        model()->addGhostCells(p,onWhichPartition);
      }
      void addPyramid(MPyramid *p, unsigned int onWhichPartition)
      {
        GRegion::addPyramid(p);
        _ghostCells.insert(std::pair<MElement*, unsigned int>(p,onWhichPartition));