Skip to content
Snippets Groups Projects
Select Git revision
  • 1d1461a32b9539a7788a29f35c736780b49024af
  • 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

CutMap.h

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    OctreeInternals.cpp 13.25 KiB
    // Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include <list>
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include "GmshMessage.h"
    #include "OctreeInternals.h"
    
    int initializeOctantBuckets(double *_orig, double *_size, int _maxElem,
                                octantBucket **buckets_head, globalInfo **globalPara)
    // Initialize the buckets                                          
    // Given by user: orig and size -- information about the domain    
    //                maxElem -- maximum number of elements per bucket 
    // Return: buckets -- pointer to the begin of buckets              
    //         globalPara -- some info about the buckets               
    // At last, 1 will be returned if succeed, otherwise, return 0     
    {
      int i, j, k, tmp1; 
      int p = 1;
      int initial_buckets_num;  // which is a number of 8^p form for integer p 
      double tmp[3], error[3];
      octantBucket *buckets;
    
      for (i = 0; i < 3; i++)
        error[i]= _size[i]*0.01;
    
      initial_buckets_num = (int)pow(8., p); // it is actually 8 
    
      (*globalPara) = new globalInfo;
      (*globalPara)->maxPrecision = 1;
      (*globalPara)->maxElements = _maxElem;
      (*globalPara)->ptrToPrevElement = NULL;
    
      for (i = 0; i < 3; i++) {
        (*globalPara)->origin[i] = _orig[i];
        (*globalPara)->size[i] = _size[i];
      }
    
      (*globalPara)->numBuckets = initial_buckets_num;
      *buckets_head = new octantBucket;
      if (!(*buckets_head)) {
        Msg::Error("initializeOctantBuckets could not allocate enough space");
        return (0);
      } // if could not allocate buckets 
    
      buckets = new octantBucket[8];
      if (!buckets) { 
        Msg::Error("initializeOctantBuckets could not allocate enough space");
        return (0);
      }
    
      (*buckets_head)->next = buckets;
      (*buckets_head)->parent = NULL;
      (*buckets_head)->numElements = 0;
      (*buckets_head)->lhead = NULL;
      (*buckets_head)->precision = 0;
      for (i = 0; i< 3; i++) {
        (*buckets_head)->minPt[i] = _orig[i]-error[i];
        (*buckets_head)->maxPt[i] = _size[i]+_orig[i]+error[i];
      }
    
      for (i = 0; i < (*globalPara)->numBuckets; i++) {
        buckets[i].numElements = 0;
        buckets[i].lhead = NULL;
        buckets[i].next = NULL;
        buckets[i].parent = *buckets_head;