Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Leibner
dune-common
Commits
03b27191
Commit
03b27191
authored
20 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
New constructor with control over the UG environment heap size
[[Imported from SVN: r962]]
parent
56de3a85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
grid/uggrid.hh
+19
-3
19 additions, 3 deletions
grid/uggrid.hh
grid/uggrid/uggrid.cc
+36
-2
36 additions, 2 deletions
grid/uggrid/uggrid.cc
with
55 additions
and
5 deletions
grid/uggrid.hh
+
19
−
3
View file @
03b27191
...
...
@@ -26,7 +26,7 @@
namespace
Dune
{
/** @defgroup UGGrid UGGrid
Imp
/** @defgroup UGGrid UGGrid
\ingroup GridCommon
This is the implementation of the grid interface
...
...
@@ -157,11 +157,19 @@ namespace Dune {
/** \brief Constructor with control over UG's memory requirements
*
* \param heap The size of UG's internal memory in megabytes. UG allocates
* \param heap
Size
The size of UG's internal memory in megabytes. UG allocates
* memory only once. I don't know what happens if you create UGGrids with
* differing heap sizes.
* \param envHeapSize The size of UG's environment heap.
*/
UGGrid
(
unsigned
int
heap
=
500
);
UGGrid
(
unsigned
int
heapSize
,
unsigned
int
envHeapSize
);
/** \brief Constructor with default memory settings
*
* The default values are 500MB for the general heap and 10MB for
* the environment heap.
*/
UGGrid
();
//! Desctructor
~
UGGrid
();
...
...
@@ -215,6 +223,9 @@ namespace Dune {
void
*
extra_boundary_data_
;
private
:
void
init
(
unsigned
int
heapSize
,
unsigned
int
envHeapSize
);
// Each UGGrid object has a unique name to identify it in the
// UG environment structure
std
::
string
name_
;
...
...
@@ -228,6 +239,11 @@ namespace Dune {
// number of entitys of each level an codim
Array
<
int
>
size_
;
//! Marks whether the UG environment heap size is taken from
//! an existing defaults file or whether the values from
//! the UGGrid constructor are taken
bool
useExistingDefaultsFile
;
protected
:
/** \brief Number of UGGrids currently in use.
*
...
...
This diff is collapsed.
Click to expand it.
grid/uggrid/uggrid.cc
+
36
−
2
View file @
03b27191
...
...
@@ -30,10 +30,41 @@ namespace Dune
template
<
>
int
UGGrid
<
3
,
3
>::
numOfUGGrids
=
0
;
template
<
int
dim
,
int
dimworld
>
inline
UGGrid
<
dim
,
dimworld
>::
UGGrid
(
unsigned
int
heap
)
:
heapsize
(
heap
)
inline
UGGrid
<
dim
,
dimworld
>::
UGGrid
()
{
init
(
500
,
10
);
}
template
<
int
dim
,
int
dimworld
>
inline
UGGrid
<
dim
,
dimworld
>::
UGGrid
(
unsigned
int
heapSize
,
unsigned
envHeapSize
)
{
init
(
heapSize
,
envHeapSize
);
}
template
<
int
dim
,
int
dimworld
>
inline
void
UGGrid
<
dim
,
dimworld
>::
init
(
unsigned
int
heapSize
,
unsigned
envHeapSize
)
{
heapsize
=
heapSize
;
if
(
numOfUGGrids
==
0
)
{
useExistingDefaultsFile
=
false
;
if
(
access
(
"defaults"
,
F_OK
)
==
0
)
{
std
::
cout
<<
"Using existing UG defaults file"
<<
std
::
endl
;
useExistingDefaultsFile
=
true
;
}
else
{
// Pass the explicitly given environment heap size
// This is only possible by passing a pseudo 'defaults'-file
FILE
*
fp
=
fopen
(
"defaults"
,
"w"
);
fprintf
(
fp
,
"envmemory %d000000
\n
"
,
envHeapSize
);
fclose
(
fp
);
}
// Init the UG system
int
argc
=
1
;
char
*
arg
=
{
"dune.exe"
};
...
...
@@ -58,7 +89,6 @@ namespace Dune
1
,
coeffs
,
1
,
upp
)
==
NULL
)
assert
(
false
);
// A Dummy new format
// We need to pass the parameters in this complicated way, because
// UG writes into one of the strings, and code compiled by some
...
...
@@ -116,6 +146,10 @@ namespace Dune
for
(
int
i
=
0
;
i
<
4
;
i
++
)
free
(
newformatArgs
[
i
]);
// remove defaults file, if we wrote one on startup
if
(
!
useExistingDefaultsFile
)
system
(
"rm defaults"
);
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment