From bcfed3c29ccdbd35b04eebf52a7e12c7907df60b Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Fri, 15 May 2020 13:53:24 +0200 Subject: [PATCH 1/3] Remove the UGLIB flag It was used to distinguish headers that were internal to UG. However, today all code in dune-uggrid is internal to the Dune grid interface, and therefore the old distinction is not needed anymore. --- CMakeLists.txt | 3 --- dune/uggrid/domain/std_internal.h | 4 ---- dune/uggrid/low/architecture.h | 4 ---- dune/uggrid/low/ugtime.h | 4 ---- 4 files changed, 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afd07b3f6..cdc10dc0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,6 @@ if(UG_ENABLE_DEBUGGING) set(UG_EXTRAFLAGS "${UG_EXTRAFLAGS} -DDebug") endif() -add_definitions(-DUGLIB) -set(UG_EXTRAFLAGS "${UG_EXTRAFLAGS} -DUGLIB") - #Always build parallel libs if MPI is found if(UG_ENABLE_PARALLEL) if(NOT MPI_C_FOUND) diff --git a/dune/uggrid/domain/std_internal.h b/dune/uggrid/domain/std_internal.h index 8ede2e46e..5c773dbf1 100644 --- a/dune/uggrid/domain/std_internal.h +++ b/dune/uggrid/domain/std_internal.h @@ -3,10 +3,6 @@ #ifndef UG_STD_INTERNAL_H #define UG_STD_INTERNAL_H -#ifndef UGLIB -#error internal header! Must not be used in Applications! -#endif - #include <dune/uggrid/low/dimension.h> #include <dune/uggrid/low/namespace.h> diff --git a/dune/uggrid/low/architecture.h b/dune/uggrid/low/architecture.h index 9579a0599..c9653d8a3 100644 --- a/dune/uggrid/low/architecture.h +++ b/dune/uggrid/low/architecture.h @@ -11,10 +11,6 @@ #ifndef UG_ARCHITECTURE_H #define UG_ARCHITECTURE_H -#ifndef UGLIB -#error Internal UG-lib header, must not be used in applications! -#endif - /* SMALL..: least number s.t. 1 + SMALL../SMALL_FAC != 1 */ #define SMALL_FAC 10 diff --git a/dune/uggrid/low/ugtime.h b/dune/uggrid/low/ugtime.h index 174feccac..75dee99fc 100644 --- a/dune/uggrid/low/ugtime.h +++ b/dune/uggrid/low/ugtime.h @@ -10,10 +10,6 @@ #ifndef UG_UGTIME_H #define UG_UGTIME_H -#ifndef UGLIB -#error Internal UG-lib header, must not be used in applications! -#endif - /* stolen from autoconf-docs */ #if TIME_WITH_SYS_TIME # include <sys/time.h> -- GitLab From 81af3cba4043b7f84fd3f33ee9afcab120b65f61 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Fri, 15 May 2020 13:54:58 +0200 Subject: [PATCH 2/3] Do not set DYNAMIC_MEMORY_ALLOCMODEL and UG_FOR_DUNE The flags have been removed from the code a while ago. --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdc10dc0e..c41fbab48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,8 +132,6 @@ macro(ug_add_dim_libs LIB_NAME) set(_append "APPEND") # Do not overwrite but append next lib in export endforeach() endmacro() -# !!! maybe make this configurable later -set(DYNAMIC_MEMORY_ALLOCMODEL True) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(time.h HAVE_TIME_H) @@ -148,7 +146,6 @@ add_subdirectory(cmake/modules) set(DDD_MAX_PROCBITS_IN_GID ${UG_DDD_MACROBITS}) # finalize the dune project, e.g., generate config.h etc. # Use package init to set additional information -set(dune-uggrid_INIT "set(UG_PARALLEL ${UG_ENABLE_PARALLEL}) -set(UG_FOR_DUNE yes)") +set(dune-uggrid_INIT "set(UG_PARALLEL ${UG_ENABLE_PARALLEL})") finalize_dune_project(GENERATE_CONFIG_H_CMAKE) -- GitLab From ca1fb61b380f05a457837994ed2ab97a6c6e417c Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Fri, 15 May 2020 13:57:33 +0200 Subject: [PATCH 3/3] Remove the file evalproc.cc It is not used. --- dune/uggrid/gm/CMakeLists.txt | 2 +- dune/uggrid/gm/evalproc.cc | 158 ----------------------------- dune/uggrid/gm/gm.h | 35 ------- dune/uggrid/gm/initgm.cc | 7 -- dune/uggrid/gm/ugio.cc | 181 ---------------------------------- 5 files changed, 1 insertion(+), 382 deletions(-) delete mode 100644 dune/uggrid/gm/evalproc.cc diff --git a/dune/uggrid/gm/CMakeLists.txt b/dune/uggrid/gm/CMakeLists.txt index 67f47a692..06565f4e9 100644 --- a/dune/uggrid/gm/CMakeLists.txt +++ b/dune/uggrid/gm/CMakeLists.txt @@ -1,6 +1,6 @@ set(SOURCES algebra.cc enrol.cc evm.cc mgio.cc ugio.cc ugm.cc cw.cc initgm.cc elements.cc - shapes.cc evalproc.cc rm.cc refine.cc + shapes.cc rm.cc refine.cc dlmgr.cc gmcheck.cc er.cc mgheapmgr.cc rm-write2file.cc ) # put this "template" into distribution-tarball as well set(EXTRA_DIST dlmgr.t) diff --git a/dune/uggrid/gm/evalproc.cc b/dune/uggrid/gm/evalproc.cc deleted file mode 100644 index 42b81418a..000000000 --- a/dune/uggrid/gm/evalproc.cc +++ /dev/null @@ -1,158 +0,0 @@ -// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -// vi: set et ts=4 sw=2 sts=2: -/****************************************************************************/ -/* */ -/* File: evalproc.c */ -/* */ -/* Purpose: evaluation functions */ -/* */ -/* Author: Peter Bastian */ -/* Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen */ -/* Universitaet Heidelberg */ -/* Im Neuenheimer Feld 368 */ -/* 6900 Heidelberg */ -/* internet: ug@ica3.uni-stuttgart.de */ -/* */ -/* History: 31.03.92 begin, ug version 2.0 */ -/* */ -/* Remarks: */ -/* */ -/****************************************************************************/ - -/****************************************************************************/ -/* */ -/* include files */ -/* system include files */ -/* application include files */ -/* */ -/****************************************************************************/ - -#include <config.h> - -#include <cstring> -#include <cstdio> -#include <cstdlib> - -#include <dune/uggrid/low/ugenv.h> - -#include "gm.h" -#include "evm.h" -#include <dune/uggrid/ugdevices.h> -#include "shapes.h" -#include "elements.h" - -USING_UG_NAMESPACES - -/****************************************************************************/ -/* */ -/* definition of variables global to this source file only (static!) */ -/* */ -/****************************************************************************/ - -/* environment directory and item IDs used in this source file */ -static INT theEEvalProcDirID; -static INT theElemValVarID; - -static INT theMEvalProcDirID; - -static INT theVEvalProcDirID; -static INT theElemVectorVarID; - -/****************************************************************************/ -/* */ -/* forward declarations of functions used before they are defined */ -/* */ -/****************************************************************************/ - - -/****************************************************************************/ -/* - GetElementValueEvalProc - Get element value plot proceedure in evironement from name - - SYNOPSIS: - EVALUES *GetElementValueEvalProc (const char *name); - - PARAMETERS: - . name - - - DESCRIPTION: - This function gets element value plot proceedure in evironement from name. - - RETURN VALUE: - EVALUES * - .n pointer to - .n NULL if error occured. - */ -/****************************************************************************/ - -EVALUES * NS_DIM_PREFIX GetElementValueEvalProc (const char *name) -{ - if (ChangeEnvDir("/ElementEvalProcs")==NULL) return(NULL); - return((EVALUES*) SearchEnv(name,".",theElemValVarID,SEARCHALL)); -} - -/****************************************************************************/ -/* - InitEvalProc - Init this file - - SYNOPSIS: - INT InitEvalProc (); - - PARAMETERS: - . void - - - DESCRIPTION: - This function inits this file. - - RETURN VALUE: - INT - .n 0 if ok - .n 1 if error occured. - */ -/****************************************************************************/ - -INT NS_DIM_PREFIX InitEvalProc () -{ - /* install the /ElementEvalProcs directory */ - if (ChangeEnvDir("/")==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not changedir to root"); - return(__LINE__); - } - theEEvalProcDirID = GetNewEnvDirID(); - if (MakeEnvItem("ElementEvalProcs",theEEvalProcDirID,sizeof(ENVDIR))==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not install '/ElementEvalProcs' dir"); - return(__LINE__); - } - theElemValVarID = GetNewEnvVarID(); - - /* install the /MatrixEvalProcs directory */ - if (ChangeEnvDir("/")==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not changedir to root"); - return(__LINE__); - } - theMEvalProcDirID = GetNewEnvDirID(); - if (MakeEnvItem("MatrixEvalProcs",theMEvalProcDirID,sizeof(ENVDIR))==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not install '/MatrixEvalProcs' dir"); - return(__LINE__); - } - - /* install the /ElementVectorEvalProcs directory */ - if (ChangeEnvDir("/")==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not changedir to root"); - return(__LINE__); - } - theVEvalProcDirID = GetNewEnvDirID(); - if (MakeEnvItem("ElementVectorEvalProcs",theVEvalProcDirID,sizeof(ENVDIR))==NULL) - { - PrintErrorMessage('F',"InitEvalProc","could not install '/ElementVectorEvalProcs' dir"); - return(__LINE__); - } - theElemVectorVarID = GetNewEnvVarID(); - - return (0); -} diff --git a/dune/uggrid/gm/gm.h b/dune/uggrid/gm/gm.h index 731757b5c..906881718 100644 --- a/dune/uggrid/gm/gm.h +++ b/dune/uggrid/gm/gm.h @@ -1608,34 +1608,6 @@ typedef struct grid GRID; typedef struct multigrid MULTIGRID; typedef union object_with_key KEY_OBJECT; -/****************************************************************************/ -/* */ -/* structs for evaluation functions */ -/* */ -/****************************************************************************/ - -/*----------- typedef for functions ----------------------------------------*/ - -typedef INT (*PreprocessingProcPtr)(const char *, MULTIGRID *); -typedef DOUBLE (*ElementEvalProcPtr)(const ELEMENT *,const DOUBLE **,DOUBLE *); -typedef DOUBLE (*MatrixEvalProcPtr)(const MATRIX *); - -/*----------- definition of structs ----------------------------------------*/ - -struct elementvalues { - - /** \brief Fields for environment list variable */ - NS_PREFIX ENVVAR v; - - /** \brief Prepare eval values */ - PreprocessingProcPtr PreprocessProc; - - /** \brief Pointer to corresponding function */ - ElementEvalProcPtr EvalProc; -}; - -typedef struct elementvalues EVALUES ; - /****************************************************************************/ /* */ /* algebraic dependency for vector ordering */ @@ -3105,9 +3077,6 @@ INT SaveMultiGrid (MULTIGRID *theMG, const char *name, const char *t INT DisposeGrid (GRID *theGrid); INT DisposeMultiGrid (MULTIGRID *theMG); INT Collapse (MULTIGRID *theMG); -#ifdef __TWODIM__ -INT SaveCnomGridAndValues (MULTIGRID *theMG, char *FileName, char *plotprocName, char *tagName); -#endif /* coarse grid manipulations */ NODE *InsertInnerNode (GRID *theGrid, const DOUBLE *pos); @@ -3194,10 +3163,6 @@ void WriteCW (void *obj, INT ce, INT ALG_DEP *CreateAlgebraicDependency (const char *name, DependencyProcPtr DependencyProc); FIND_CUT *CreateFindCutProc (const char *name, FindCutProcPtr FindCutProc); -/* functions for evaluation-fct management */ -INT InitEvalProc (void); -EVALUES *GetElementValueEvalProc (const char *name); - /* miscellaneous */ INT RenumberMultiGrid (MULTIGRID *theMG, INT *nboe, INT *nioe, INT *nbov, INT *niov, NODE ***vid_n, INT *foid, INT *non, INT MarkKey); INT MGSetVectorClasses (MULTIGRID *theMG); diff --git a/dune/uggrid/gm/initgm.cc b/dune/uggrid/gm/initgm.cc index eea1fc698..d0711eb91 100644 --- a/dune/uggrid/gm/initgm.cc +++ b/dune/uggrid/gm/initgm.cc @@ -128,13 +128,6 @@ INT NS_DIM_PREFIX InitGm () return (err); } - /* init evalproc.c */ - if ((err=InitEvalProc())!=0) - { - SetHiWrd(err,__LINE__); - return (err); - } - /* rm.c */ if ((err=InitRuleManager())!=0) { diff --git a/dune/uggrid/gm/ugio.cc b/dune/uggrid/gm/ugio.cc index ce9043520..cbdedda7d 100644 --- a/dune/uggrid/gm/ugio.cc +++ b/dune/uggrid/gm/ugio.cc @@ -3485,187 +3485,6 @@ nparfiles = UG_GlobalMinINT(*ppifContext, nparfiles); return (theMG); } -#ifdef __TWODIM__ -/****************************************************************************/ -/** \brief Save 2d grid & data in cnom format - - \param theMG - pointer to multigrid structure - \param stream - file on which data is written - \param symname - name of data field - - Is called by the CnomCommand. - - */ -/****************************************************************************/ - -INT NS_DIM_PREFIX SaveCnomGridAndValues (MULTIGRID *theMG, char *docName, char *plotprocName, char *tag) -{ - ELEMENT *theElement; - VERTEX *theVertex; - GRID *theGrid; - long nv,ne,id; - int i,j,k,n; - double min,max,val; - DOUBLE *CoordOfCornerPtr[8]; - FILE *stream; - EVALUES *PlotProcInfo; - - if (theMG==NULL) - return(0); - - if ((PlotProcInfo=GetElementValueEvalProc(plotprocName))==NULL) - { - PrintErrorMessage('E',"SaveCnomGridAndValues","can't find ElementValueEvalProc"); - REP_ERR_RETURN(1); - } - - stream = fopen(docName,"w"); - if (stream==NULL) - { - PrintErrorMessage('E',"SaveCnomGridAndValues","can't open file"); - REP_ERR_RETURN(1); - } - - if (PlotProcInfo->PreprocessProc!=NULL) - if ((*PlotProcInfo->PreprocessProc)(NULL,theMG)!=0) - REP_ERR_RETURN(1); - - j=TOPLEVEL(theMG); - - /* count elements and vertices */ - nv = ne = 0; - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theVertex=FIRSTVERTEX(theGrid); theVertex!=NULL; theVertex=SUCCV(theVertex)) - { - nv++; - SETUSED(theVertex,0); - } - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - ne++; - } - - /* write header */ - fprintf(stream,">DATA\n"); - fprintf(stream,">TIME(S) 0.0\n"); - fprintf(stream,">NV: %ld\n",nv); - fprintf(stream,">NE: %ld\n",ne); - - /* compute min and max */ - min = MAX_D; max = -MAX_D; - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - { - CORNER_COORDINATES(theElement,n,CoordOfCornerPtr); - for (i=0; i<n; i++) - { - val=(*PlotProcInfo->EvalProc)(theElement, (const DOUBLE **) CoordOfCornerPtr, LOCAL_COORD_OF_ELEM(theElement,i)); - min = MIN(val,min); - max = MAX(val,max); - } - } - } - - fprintf(stream,">MIN\n"); - fprintf(stream," %s\n",tag); - fprintf(stream," %15.8E\n",min); - fprintf(stream,">MAX\n"); - fprintf(stream," %s\n", tag); - fprintf(stream," %15.8E\n",max); - fprintf(stream,">FIN\n"); - - /* write x values now */ - fprintf(stream,">X\n"); - id = 0; - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - for (i=0; i<TAG(theElement); i++) - { - theVertex=MYVERTEX(CORNER(theElement,i)); - if (USED(theVertex)) continue; - fprintf(stream," %15.8E",(double)XC(theVertex)); - ID(theVertex)=id++; - if (id%5==0) fprintf(stream,"\n"); - SETUSED(theVertex,1); - } - } - if (id%5!=0) fprintf(stream,"\n"); - - /* write y values now */ - fprintf(stream,">Y\n"); - id = 0; - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - for (i=0; i<TAG(theElement); i++) - { - theVertex=MYVERTEX(CORNER(theElement,i)); - if (USED(theVertex)==0) continue; - fprintf(stream," %15.8E",(double)YC(theVertex)); - id++; - if (id%5==0) fprintf(stream,"\n"); - SETUSED(theVertex,0); - } - } - if (id%5!=0) fprintf(stream,"\n"); - - /* write element list now */ - fprintf(stream,">E\n"); - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - { - if (TAG(theElement)==3) - fprintf(stream,"%ld %ld %ld\n",(long)ID(MYVERTEX(CORNER(theElement,0))),(long)ID(MYVERTEX(CORNER(theElement,1))),(long)ID(MYVERTEX(CORNER(theElement,2)))); - else - fprintf(stream,"%ld %ld %ld %ld\n",(long)ID(MYVERTEX(CORNER(theElement,0))),(long)ID(MYVERTEX(CORNER(theElement,1))),(long)ID(MYVERTEX(CORNER(theElement,2))),(long)ID(MYVERTEX(CORNER(theElement,3)))); - } - } - - /* write data field now */ - fprintf(stream,">Z\n"); - fprintf(stream," %s\n",tag); - id = 0; - for (k=0; k<=j; k++) - { - theGrid = GRID_ON_LEVEL(theMG,k); - for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement)) - if ((k==j)||LEAFELEM(theElement)) - { - CORNER_COORDINATES(theElement,n,CoordOfCornerPtr); - for (i=0; i<n; i++) - { - theVertex=MYVERTEX(CORNER(theElement,i)); - if (USED(theVertex)) continue; - val=(*PlotProcInfo->EvalProc)(theElement, (const DOUBLE **) CoordOfCornerPtr, LOCAL_COORD_OF_ELEM(theElement,i)); - fprintf(stream," %15.8E",val); - id++; - if (id%5==0) fprintf(stream,"\n"); - SETUSED(theVertex,1); - } - } - } - if (id%5!=0) fprintf(stream,"\n"); - - fprintf(stream,"<\n"); - fclose(stream); - - return(0); -} -#endif - INT NS_DIM_PREFIX InitUgio () { /* read gridpaths from defaults file (iff) */ -- GitLab