Skip to content
Snippets Groups Projects
Select Git revision
  • a62c9c42a4c1b802ea51c26d5e2c92593b95bdf5
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • 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
  • gmsh_2_8_6
26 results

GModelIO.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    OctreePost.cpp 16.98 KiB
    // Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include "Octree.h"
    #include "OctreePost.h"
    #include "PView.h"
    #include "PViewData.h"
    #include "PViewDataList.h"
    #include "PViewDataGModel.h"
    #include "Numeric.h"
    #include "GmshMessage.h"
    #include "shapeFunctions.h"
    #include "GModel.h"
    #include "MElement.h"
    #include "Context.h"
    
    // helper routines for list-based views
    
    static void minmax(int n, double *X, double *Y, double *Z,
                       double *min, double *max)
    {
      min[0] = X[0];
      min[1] = Y[0];
      min[2] = Z[0];
      max[0] = X[0];
      max[1] = Y[0];
      max[2] = Z[0];
      for(int i = 1; i < n; i++) {
        min[0] = (X[i] < min[0]) ? X[i] : min[0];
        min[1] = (Y[i] < min[1]) ? Y[i] : min[1];
        min[2] = (Z[i] < min[2]) ? Z[i] : min[2];
        max[0] = (X[i] > max[0]) ? X[i] : max[0];
        max[1] = (Y[i] > max[1]) ? Y[i] : max[1];
        max[2] = (Z[i] > max[2]) ? Z[i] : max[2];
      }
    
      // make bounding boxes larger up to (absolute) geometrical tolerance
      double eps = CTX::instance()->geom.tolerance;
      for(int i = 0; i < 3; i++){
        min[i] -= eps;
        max[i] += eps;
      }
    }
    
    static void centroid(int n, double *X, double *Y, double *Z, double *c)
    {
      const double oc = 1./(double)n;
      c[0] = X[0];
      c[1] = Y[0];
      c[2] = Z[0];
      for(int i = 1; i < n; i++) {
        c[0] += X[i];
        c[1] += Y[i];
        c[2] += Z[i];
      }
      c[0] *= oc;
      c[1] *= oc;
      c[2] *= oc;
    }
    
    void linBB(void *a, double *min, double *max)
    {
      double *X = (double*) a, *Y = &X[2], *Z = &X[4];
      minmax(2, X, Y, Z, min, max);
    }
    
    void triBB(void *a, double *min, double *max)
    {