Skip to content
Snippets Groups Projects
Select Git revision
  • f778a1fd0aca0c532362682e470c5214343d30dc
  • master default protected
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • patches-4.14
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • hierarchical-basis
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • 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

linearSystemCSR.cpp

Blame
  • linearSystemCSR.cpp 11.93 KiB
    // Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <complex>
    #include "GmshConfig.h"
    #include "GmshMessage.h"
    #include "linearSystemCSR.h"
    #include "OS.h"
    
    #define SWAP(a, b)                                                             \
      temp = (a);                                                                  \
      (a) = (b);                                                                   \
      (b) = temp;
    #define SWAPI(a, b)                                                            \
      tempi = (a);                                                                 \
      (a) = (b);                                                                   \
      (b) = tempi;
    
    static void *CSRMalloc(size_t size)
    {
      void *ptr;
      if(!size) return (NULL);
      ptr = malloc(size);
      return (ptr);
    }
    
    static void *CSRRealloc(void *ptr, size_t size) { return realloc(ptr, size); }
    
    static void CSRList_Realloc(CSRList_T *liste, int n)
    {
      char *temp;
      if(n <= 0) return;
      if(liste->array == NULL) {
        liste->nmax = ((n - 1) / liste->incr + 1) * liste->incr;
        liste->array = (char *)CSRMalloc(liste->nmax * liste->size);
      }
      else {
        if(n > liste->nmax) {
          liste->nmax = ((n - 1) / liste->incr + 1) * liste->incr;
          temp = (char *)CSRRealloc(liste->array, liste->nmax * liste->size);
          liste->array = temp;
        }
      }
    }
    
    static void CSRList_Resize_strict(CSRList_T *liste, int n)
    {
      liste->array = (char *)CSRRealloc(liste->array, n * liste->size);
      liste->n = n;
      liste->nmax = n;
    }
    
    static CSRList_T *CSRList_Create(int n, int incr, int size)
    {
      CSRList_T *liste;
    
      if(n <= 0) n = 1;
      if(incr <= 0) incr = 1;
    
      liste = (CSRList_T *)CSRMalloc(sizeof(CSRList_T));
    
      liste->nmax = 0;
      liste->incr = incr;
      liste->size = size;
      liste->n = 0;