From 6705013e5f39f3262d557c27d5b44fe8a1dc2f1c Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Thu, 28 Nov 2019 09:49:28 +0100 Subject: [PATCH 1/2] Remove 'heapSize' parameter from CreateMultiGrid method It is not used anyway. --- gm/gm.h | 2 +- gm/ugio.cc | 2 +- gm/ugm.cc | 5 ++--- ui/commands.cc | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gm/gm.h b/gm/gm.h index ba9a5cd6f..9b2b2a035 100644 --- a/gm/gm.h +++ b/gm/gm.h @@ -3159,7 +3159,7 @@ FORMAT *CreateFormat (char *name, INT sVertex, INT sMultiGrid, /* create, saving and disposing a multigrid structure */ MULTIGRID *CreateMultiGrid (char *MultigridName, char *BndValProblem, - const char *format, NS_PREFIX MEM heapSize, + const char *format, INT optimizedIE, INT insertMesh, std::shared_ptr<PPIF::PPIFContext> ppifContext = nullptr); MULTIGRID *OpenMGFromDataFile(MULTIGRID *theMG, INT number, char *type, diff --git a/gm/ugio.cc b/gm/ugio.cc index 3d377d7fa..7e2be3538 100644 --- a/gm/ugio.cc +++ b/gm/ugio.cc @@ -2943,7 +2943,7 @@ nparfiles = UG_GlobalMinINT(*ppifContext, nparfiles); if (heapSize==0) heapSize = mg_general.heapsize * KBYTE; /* create a virginenal multigrid on the BVP */ - theMG = CreateMultiGrid(MGName,BndValName,FormatName,heapSize,true,false, ppifContext); + theMG = CreateMultiGrid(MGName,BndValName,FormatName,true,false, ppifContext); if (theMG==NULL) { UserWrite("ERROR(ugio): cannot create multigrid\n"); CloseMGFile (); diff --git a/gm/ugm.cc b/gm/ugm.cc index 3065c59ea..1377391d0 100644 --- a/gm/ugm.cc +++ b/gm/ugm.cc @@ -3013,7 +3013,6 @@ MULTIGRID * NS_DIM_PREFIX GetNextMultigrid (const MULTIGRID *theMG) * @param domain - name of domain description from environment * @param problem - name of problem description from environment * @param format - name of format description from environment - * @param heapSize - size of heap to allocate for that multigrid in bytes * @param optimizedIE - allocate NodeElementList This function creates and initializes a new multigrid structure including @@ -3027,7 +3026,7 @@ MULTIGRID * NS_DIM_PREFIX GetNextMultigrid (const MULTIGRID *theMG) /****************************************************************************/ MULTIGRID * NS_DIM_PREFIX CreateMultiGrid (char *MultigridName, char *BndValProblem, - const char *format, MEM heapSize, INT optimizedIE, INT insertMesh, + const char *format, INT optimizedIE, INT insertMesh, std::shared_ptr<PPIF::PPIFContext> ppifContext) { HEAP *theHeap; @@ -3065,7 +3064,7 @@ MULTIGRID * NS_DIM_PREFIX CreateMultiGrid (char *MultigridName, char *BndValProb theHeap = NewHeap(SIMPLE_HEAP, sizeof(HEAP), malloc(sizeof(HEAP))); if (theHeap==NULL) { - UserWriteF("CreateMultiGrid: cannot allocate %ld bytes\n", heapSize); + UserWriteF("CreateMultiGrid: cannot allocate %ld bytes\n", sizeof(HEAP)); PrintErrorMessage('E', "CreateMultiGrid","Cannot allocate heap!"); DisposeMultiGrid(theMG); diff --git a/ui/commands.cc b/ui/commands.cc index 731bcc1cd..ca7c88185 100644 --- a/ui/commands.cc +++ b/ui/commands.cc @@ -283,7 +283,7 @@ INT NS_DIM_PREFIX NewCommand (INT argc, char **argv, std::shared_ptr<PPIF::PPIFC } /* allocate the multigrid structure */ - theMG = CreateMultiGrid(Multigrid,BVPName,Format,heapSize,IEopt,!emptyGrid, ppifContext); + theMG = CreateMultiGrid(Multigrid,BVPName,Format,IEopt,!emptyGrid, ppifContext); if (theMG==NULL) { PrintErrorMessage('E',"new","could not create multigrid"); -- GitLab From 01da3b016b6a302da24d3e33766a54d0606e012f Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Thu, 28 Nov 2019 09:51:01 +0100 Subject: [PATCH 2/2] NewCommand: Do not require the -h option This option used to be the heap size, but ever since we started using the system heap for everything that size does not get used anymore. --- ui/commands.cc | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ui/commands.cc b/ui/commands.cc index ca7c88185..fb1584f40 100644 --- a/ui/commands.cc +++ b/ui/commands.cc @@ -217,7 +217,6 @@ INT NS_DIM_PREFIX NewCommand (INT argc, char **argv, std::shared_ptr<PPIF::PPIFC { MULTIGRID *theMG; char Multigrid[NAMESIZE],BVPName[NAMESIZE],Format[NAMESIZE]; - MEM heapSize; INT i; bool bopt, fopt, hopt, IEopt, emptyGrid; @@ -229,7 +228,6 @@ INT NS_DIM_PREFIX NewCommand (INT argc, char **argv, std::shared_ptr<PPIF::PPIFC if ((theMG != NULL) && (theMG == currMG)) CloseCommand(0,NULL); /* get problem, domain and format */ - heapSize = 0; bopt = fopt = hopt = false; IEopt = true; emptyGrid = false; @@ -262,23 +260,14 @@ INT NS_DIM_PREFIX NewCommand (INT argc, char **argv, std::shared_ptr<PPIF::PPIFC emptyGrid = true; break; - case 'h' : - if (ReadMemSizeFromString(argv[i]+1,&heapSize)!=0) /* skip leading 'h' in argv */ - { - PrintErrorMessage('E', "NewCommand", "cannot read heapsize specification"); - return 1; - } - hopt = true; - break; - default : PrintErrorMessageF('E', "NewCommand", "Unknown option '%s'", argv[i]); return 1; } - if (!(bopt && fopt && hopt)) + if (!(bopt && fopt)) { - PrintErrorMessage('E', "NewCommand", "the d, p, f and h arguments are mandatory"); + PrintErrorMessage('E', "NewCommand", "the d, p, and f arguments are mandatory"); return 1; } -- GitLab