Skip to content
Snippets Groups Projects
Select Git revision
  • 7c3ed518c66a30dca2ab43772a7b8813b140ebd8
  • master default
  • library-names
  • fix_script_header
  • fix_libdir
  • fix_cmake_hdf5
  • partition
  • cgnsUnstructured
  • partitioning
  • HighOrderBLCurving
  • gmsh_3_0_5
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
30 results

OS.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GEdgeCompound.cpp 9.49 KiB
    // Gmsh - Copyright (C) 1997-2016 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>.
    //
    // Contributor(s):
    //   Emilie Marchandise
    //
    
    #include <stdlib.h>
    #include "GmshConfig.h"
    #include "GEdgeCompound.h"
    #include "discreteEdge.h"
    #include "Numeric.h"
    #include "Curvature.h"
    
    static bool looksOk(int tag, std::vector<GEdge*> &compound)
    {
      if(compound.empty()){
        Msg::Error("Empty edge compound %d", tag);
        return false;
      }
      for(unsigned int i = 0; i < compound.size(); i++){
        if(!compound[i]->getBeginVertex() || !compound[i]->getEndVertex()){
          Msg::Error("Edge compound %d with missing begin/end vertex", tag);
          return false;
        }
        if(compound.size() > 1 && compound[i]->getBeginVertex() == compound[i]->getEndVertex()){
          Msg::Warning("Edge compound %d with subloop", tag);
          return true;
        }
      }
      return true;
    }
    
    GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound,
                                 std::vector<int> &orientation)
      : GEdge(m, tag, 0, 0), _compound(compound), _orientation(orientation)
    {
      if(!looksOk(tag, compound)) return;
    
      int N = _compound.size();
      if(N == (int)_orientation.size()){
        v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex();
        v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex();
        v0->addEdge(this);
        v1->addEdge(this);
      }
      else{
        Msg::Error("Wrong input data for compound edge %d", tag);
        return;
      }
    
      for (unsigned int i = 0; i < _compound.size(); i++)
        _compound[i]->setCompound(this);
    
      for(std::vector<GEdge*>::iterator it = _compound.begin(); it != _compound.end(); ++it){
        if(!(*it)){
          Msg::Error("Incorrect edge in compound edge %d", tag);
          return;
        }
      }
    
      parametrize();
    }
    
    GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound)
      : GEdge(m, tag, 0 , 0), _compound(compound)
    {
      if(!looksOk(tag, compound)) return;