Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-alugrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-alugrid
Commits
6831d9ef
Commit
6831d9ef
authored
9 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[cleanup] Remove output stream overloading.
parent
833f0216
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/alugrid/common/geostorage.hh
+20
-22
20 additions, 22 deletions
dune/alugrid/common/geostorage.hh
with
20 additions
and
22 deletions
dune/alugrid/common/geostorage.hh
+
20
−
22
View file @
6831d9ef
#ifndef DUNE_ALUGRIDGEOMETRYSTORAGE_HH
#ifndef DUNE_ALUGRIDGEOMETRYSTORAGE_HH
#define DUNE_ALUGRIDGEOMETRYSTORAGE_HH
#define DUNE_ALUGRIDGEOMETRYSTORAGE_HH
#include
<array>
#include
<dune/common/exceptions.hh>
#include
<dune/common/exceptions.hh>
#include
<dune/grid/common/grid.hh>
#include
<dune/grid/common/grid.hh>
...
@@ -17,7 +19,7 @@ namespace Dune
...
@@ -17,7 +19,7 @@ namespace Dune
typedef
ALULocalGeometryStorage
<
GridImp
,
GeometryImpl
,
nChild
>
ThisType
;
typedef
ALULocalGeometryStorage
<
GridImp
,
GeometryImpl
,
nChild
>
ThisType
;
// array with pointers to the geometries
// array with pointers to the geometries
Dune
::
array
<
GeometryImpl
*
,
nChild
>
geoms_
;
std
::
array
<
GeometryImpl
*
,
nChild
>
geoms_
;
// count local geometry creation
// count local geometry creation
int
count_
;
int
count_
;
...
@@ -153,7 +155,7 @@ namespace Dune
...
@@ -153,7 +155,7 @@ namespace Dune
:
count_
(
0
),
initialized_
(
false
)
:
count_
(
0
),
initialized_
(
false
)
{
{
// nullify geometries
// nullify geometries
geoms_
.
fill
(
(
GeometryImpl
*
)
0
);
geoms_
.
fill
(
nullptr
);
// initialize geometries
// initialize geometries
initialize
(
type
,
nonConform
);
initialize
(
type
,
nonConform
);
...
@@ -164,7 +166,7 @@ namespace Dune
...
@@ -164,7 +166,7 @@ namespace Dune
:
count_
(
0
),
initialized_
(
false
)
:
count_
(
0
),
initialized_
(
false
)
{
{
// nullify geometries
// nullify geometries
geoms_
.
fill
(
(
GeometryImpl
*
)
0
);
geoms_
.
fill
(
nullptr
);
}
}
// desctructor deleteing geometries
// desctructor deleteing geometries
...
@@ -179,17 +181,14 @@ namespace Dune
...
@@ -179,17 +181,14 @@ namespace Dune
{
{
alugrid_assert
(
geomCreated
(
child
)
);
alugrid_assert
(
geomCreated
(
child
)
);
// this method is not thread safe yet
// this method is not thread safe yet
assert
(
GridImp
::
thread
()
==
0
);
return
*
(
geoms_
[
child
]);
return
*
(
geoms_
[
child
]);
}
}
//! access local geometries
//! access local geometries
static
const
GeometryImpl
&
geom
(
const
GeometryType
type
,
const
bool
nonConforming
,
const
int
child
)
static
const
GeometryImpl
&
geom
(
const
GeometryType
type
,
const
bool
nonConforming
,
const
int
child
)
{
{
// this method is not thread safe yet
// create static variable for this thread
assert
(
GridImp
::
thread
()
==
0
);
static
thread_local
ThisType
instance
(
type
,
nonConforming
);
// create static variable on heap
static
ThisType
instance
(
type
,
nonConforming
);
// make sure the geometry type is the same
// make sure the geometry type is the same
alugrid_assert
(
type
==
instance
[
child
].
type
()
);
alugrid_assert
(
type
==
instance
[
child
].
type
()
);
return
instance
[
child
];
return
instance
[
child
];
...
@@ -200,8 +199,8 @@ namespace Dune
...
@@ -200,8 +199,8 @@ namespace Dune
{
{
if
(
type
.
isSimplex
()
)
if
(
type
.
isSimplex
()
)
{
{
// create static variable
on h
ea
p
// create static variable
for this thr
ea
d
static
ThisType
simplexGeoms
;
static
thread_local
ThisType
simplexGeoms
;
// initialize (only done once), note that this is called recursively during initialize
// initialize (only done once), note that this is called recursively during initialize
// so only check geoms when they were actually really created
// so only check geoms when they were actually really created
if
(
simplexGeoms
.
initialize
(
type
,
nonConforming
)
)
if
(
simplexGeoms
.
initialize
(
type
,
nonConforming
)
)
...
@@ -216,8 +215,8 @@ namespace Dune
...
@@ -216,8 +215,8 @@ namespace Dune
// should be a cube geometry a this point
// should be a cube geometry a this point
alugrid_assert
(
type
.
isCube
()
);
alugrid_assert
(
type
.
isCube
()
);
// create static variable
on heap
// create static variable
static
ThisType
cubeGeoms
;
static
thread_local
ThisType
cubeGeoms
;
// initialize (only done once), note that this is called recursively during initialize
// initialize (only done once), note that this is called recursively during initialize
// so only check geoms when they were actually really created
// so only check geoms when they were actually really created
if
(
cubeGeoms
.
initialize
(
type
,
nonConforming
)
)
if
(
cubeGeoms
.
initialize
(
type
,
nonConforming
)
)
...
@@ -254,11 +253,11 @@ namespace Dune
...
@@ -254,11 +253,11 @@ namespace Dune
template
<
class
Grid
>
template
<
class
Grid
>
void
createGeometries
(
const
GeometryType
&
type
)
void
createGeometries
(
const
GeometryType
&
type
)
{
{
static
thread_local
bool
firstCall
=
true
;
static
bool
firstCall
=
true
;
if
(
firstCall
)
if
(
firstCall
)
{
{
firstCall
=
false
;
firstCall
=
false
;
// create factory without verbosity
// create factory without verbosity
GridFactory
<
Grid
>
factory
(
false
);
GridFactory
<
Grid
>
factory
(
false
);
...
@@ -284,26 +283,26 @@ namespace Dune
...
@@ -284,26 +283,26 @@ namespace Dune
factory
.
insertElement
(
type
,
vertices
);
factory
.
insertElement
(
type
,
vertices
);
// save original sbuf
// save original sbuf
std
::
streambuf
*
cerr_sbuf
=
std
::
cerr
.
rdbuf
();
//
std::streambuf* cerr_sbuf = std::cerr.rdbuf();
std
::
stringstream
tempout
;
//
std::stringstream tempout;
// redirect 'cerr' to a 'fout' to avoid unnecessary output in constructors
// redirect 'cerr' to a 'fout' to avoid unnecessary output in constructors
std
::
cerr
.
rdbuf
(
tempout
.
rdbuf
());
//
std::cerr.rdbuf(tempout.rdbuf());
Grid
*
gridPtr
=
factory
.
createGrid
();
Grid
*
gridPtr
=
factory
.
createGrid
();
Grid
&
grid
=
*
gridPtr
;
Grid
&
grid
=
*
gridPtr
;
// restore the original stream buffer
// restore the original stream buffer
std
::
cerr
.
rdbuf
(
cerr_sbuf
);
//
std::cerr.rdbuf(cerr_sbuf);
//std::cerr = savecerr;
//std::cerr = savecerr;
// refine once to get children
// refine once to get children
in the reference element
const
int
level
=
1
;
const
int
level
=
1
;
grid
.
globalRefine
(
level
);
grid
.
globalRefine
(
level
);
{
{
typedef
typename
Grid
::
template
Partition
<
All_Partition
>
::
Level
GridView
MacroGridView
;
typedef
typename
Grid
::
Macro
GridView
MacroGridView
;
MacroGridView
macroView
=
grid
.
template
level
View
<
All_Partition
>
(
0
);
MacroGridView
macroView
=
grid
.
template
macroGrid
View
<
All_Partition
>
();
typedef
typename
MacroGridView
::
template
Codim
<
0
>
::
Iterator
Iterator
;
typedef
typename
MacroGridView
::
template
Codim
<
0
>
::
Iterator
Iterator
;
Iterator
it
=
macroView
.
template
begin
<
0
>
();
Iterator
it
=
macroView
.
template
begin
<
0
>
();
...
@@ -329,7 +328,6 @@ namespace Dune
...
@@ -329,7 +328,6 @@ namespace Dune
// delete grid
// delete grid
delete
gridPtr
;
delete
gridPtr
;
}
}
}
}
// create local geometry
// create local geometry
...
...
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