From 03c752013d5982ccd309e4c6e3282980d79226b8 Mon Sep 17 00:00:00 2001 From: "Jostein R. Natvig" Date: Mon, 30 Jan 2012 11:51:09 +0000 Subject: [PATCH] Remove last references to sparse_table_t. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bård Skaflestad --- facetopology.c | 1 - processgrid_mex.m | 2 +- sparsetable.c | 100 ---------------------------------------------- sparsetable.h | 53 ------------------------ 4 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 sparsetable.c delete mode 100644 sparsetable.h diff --git a/facetopology.c b/facetopology.c index 07f8d7d2..21e7e7e6 100644 --- a/facetopology.c +++ b/facetopology.c @@ -40,7 +40,6 @@ along with OpenRS. If not, see . #include #include "preprocess.h" -#include "sparsetable.h" #include "facetopology.h" /* No checking of input arguments in this code! */ diff --git a/processgrid_mex.m b/processgrid_mex.m index 87fc65e0..52ec3fb8 100644 --- a/processgrid_mex.m +++ b/processgrid_mex.m @@ -47,7 +47,7 @@ function varargout = processgrid_mex(varargin) '-Wchar-subscripts', '-Wredundant-decls"'}; SRC = {'processgrid.c', 'preprocess.c', 'uniquepoints.c', ... - 'facetopology.c', 'sparsetable.c', 'mxgrdecl.c'}; + 'facetopology.c', 'mxgrdecl.c'}; INCLUDE = {}; diff --git a/sparsetable.c b/sparsetable.c deleted file mode 100644 index 9ef36bab..00000000 --- a/sparsetable.c +++ /dev/null @@ -1,100 +0,0 @@ -/*=========================================================================== -// -// File: sparsetable.c -// -// Created: Fri Jun 19 08:48:04 2009 -// -// Author: Jostein R. Natvig -// -// $Date$ -// -// $Revision$ -// -//==========================================================================*/ - -/* -Copyright 2009, 2010 SINTEF ICT, Applied Mathematics. -Copyright 2009, 2010 Statoil ASA. - -This file is part of The Open Reservoir Simulator Project (OpenRS). - -OpenRS is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -OpenRS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OpenRS. If not, see . -*/ - -#include -#include -#include -#include -#include - - -#include "sparsetable.h" - -void free_sparse_table (sparse_table_t *tab) -{ - if(tab->ptr) free(tab->ptr); - if(tab->data) free(tab->data); - - free(tab); -} - -sparse_table_t *malloc_sparse_table(int m, int n, int datasz) -{ - size_t alloc_sz; - sparse_table_t *tab = malloc(sizeof *tab); - tab->m = m; - tab->n = n; - tab->position = 0; - if (!(tab->ptr = malloc((m+1) * sizeof (*tab->ptr)))){ - fprintf(stderr, "Could not allocate space for sparse ptr\n"); - free_sparse_table(tab); - return NULL; - } - - alloc_sz = datasz; - alloc_sz *= n; - if(!(tab->data = malloc(alloc_sz))){ - fprintf(stderr, "Could not allocate space for sparse data(%d)\n", n); - free_sparse_table(tab); - return NULL; - } - - return tab; -} - -sparse_table_t *realloc_sparse_table(sparse_table_t *tab, int m, int n, int datasz) -{ - void *p = realloc(tab->ptr, (m+1) * sizeof (*tab->ptr)); - if (p){ - tab->ptr = p; - }else{ - fprintf(stderr, "Could not reallocate space for sparse ptr\n"); - free_sparse_table(tab); - return NULL; - } - - p = realloc(tab->data, n * datasz); - if(p){ - tab->data = p; - }else{ - fprintf(stderr, "Could not reallocate space for sparse data(%d)\n", n); - free_sparse_table(tab); - return NULL; - } - - tab->m = m; - tab->n = n; - - return tab; -} diff --git a/sparsetable.h b/sparsetable.h deleted file mode 100644 index f28df362..00000000 --- a/sparsetable.h +++ /dev/null @@ -1,53 +0,0 @@ -/*=========================================================================== -// -// File: sparsetable.h -// -// Created: Fri Jun 19 08:47:45 2009 -// -// Author: Jostein R. Natvig -// -// $Date$ -// -// $Revision$ -// -//===========================================================================*/ - -/* -Copyright 2009, 2010 SINTEF ICT, Applied Mathematics. -Copyright 2009, 2010 Statoil ASA. - -This file is part of The Open Reservoir Simulator Project (OpenRS). - -OpenRS is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -OpenRS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OpenRS. If not, see . -*/ - -#ifndef OPENRS_SPARSETABLE_HEADER -#define OPENRS_SPARSETABLE_HEADER - -typedef struct{ - int m; /* number of rows */ - int *ptr; /* row pointer of size m+1 */ - int position; /* first position in ptr that is not filled. */ - - int n; /* size of data */ - void *data; /* sparse table data */ - - -} sparse_table_t; - -void free_sparse_table (sparse_table_t *tab); -sparse_table_t *malloc_sparse_table (int m, int n, int datasz); -sparse_table_t *realloc_sparse_table (sparse_table_t *tab, int m, int n, int datasz); - -#endif /* OPENRS_SPARSETABLE_HEADER */