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
def275a1
Commit
def275a1
authored
19 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
using hasBackupRestoreFacilities to check backup and restore functionality
[[Imported from SVN: r4264]]
parent
d55f46c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io/file/grapedataio.hh
+42
-15
42 additions, 15 deletions
io/file/grapedataio.hh
with
42 additions
and
15 deletions
io/file/grapedataio.hh
+
42
−
15
View file @
def275a1
...
...
@@ -7,15 +7,15 @@
//- Dune includes
#include
<dune/common/misc.hh>
#include
<dune/common/capabilities.hh>
#include
<dune/grid/common/grid.hh>
#include
<dune/io/file/asciiparser.hh>
#include
<dune/fem/dofmanager.hh>
#include
<dune/grid/sgrid.hh>
//- Local includes
namespace
Dune
{
/*!
...
...
@@ -61,7 +61,7 @@ namespace Dune {
return
tmp
;
};
template
<
int
dim
,
int
dimworld
,
class
GridImp
>
template
<
int
dim
,
int
dimworld
,
class
GridImp
,
bool
hasBackupRestore
>
class
GrapeDataIOImp
{
typedef
GridImp
GridType
;
...
...
@@ -79,12 +79,22 @@ namespace Dune {
//! get Grid from file with time and timestep , return true if ok
inline
static
bool
readGrid
(
GridType
&
grid
,
const
GrapeIOStringType
&
fnprefix
,
double
&
time
,
int
timestep
);
//! get Grid from file with time and timestep , return true if ok
inline
static
GridType
*
restoreGrid
(
const
GrapeIOStringType
&
fnprefix
,
double
&
time
,
int
timestep
)
{
GridType
*
grid
=
new
GridType
();
assert
(
grid
);
readGrid
(
*
grid
,
fnprefix
,
time
,
timestep
);
return
grid
;
}
};
template
<
int
dim
,
int
dimworld
>
class
GrapeDataIOImp
<
dim
,
dimworld
,
S
Grid
<
dim
,
dimworld
>
>
template
<
int
dim
,
int
dimworld
,
class
GridImp
>
class
GrapeDataIOImp
<
dim
,
dimworld
,
Grid
Imp
,
false
>
{
typedef
S
Grid
<
dim
,
dimworld
>
GridType
;
typedef
Grid
Imp
GridType
;
public:
/** Write Grid with GridType file filename and time
*
...
...
@@ -105,8 +115,16 @@ namespace Dune {
{
return
false
;
}
//! get Grid from file with time and timestep , return true if ok
inline
static
GridType
*
restoreGrid
(
const
GrapeIOStringType
&
fnprefix
,
double
&
time
,
int
timestep
)
{
return
0
;
}
};
template
<
class
GridType
>
class
GrapeDataIO
{
...
...
@@ -123,7 +141,8 @@ namespace Dune {
const
GrapeIOFileFormatType
ftype
,
const
GrapeIOStringType
fnprefix
,
double
time
=
0.0
,
int
timestep
=
0
,
int
precision
=
6
)
const
{
return
GrapeDataIOImp
<
GridType
::
dimension
,
GridType
::
dimensionworld
,
GridType
>::
const
bool
hasBackupRestore
=
Capabilities
::
hasBackupRestoreFacilities
<
GridType
>::
v
;
return
GrapeDataIOImp
<
GridType
::
dimension
,
GridType
::
dimensionworld
,
GridType
,
hasBackupRestore
>::
writeGrid
(
grid
,
ftype
,
fnprefix
,
time
,
timestep
,
precision
);
}
...
...
@@ -131,9 +150,17 @@ namespace Dune {
inline
bool
readGrid
(
GridType
&
grid
,
const
GrapeIOStringType
fnprefix
,
double
&
time
,
int
timestep
)
{
return
GrapeDataIOImp
<
GridType
::
dimension
,
GridType
::
dimensionworld
,
GridType
>::
readGrid
(
grid
,
fnprefix
,
time
,
timestep
);
const
bool
hasBackupRestore
=
Capabilities
::
hasBackupRestoreFacilities
<
GridType
>::
v
;
return
GrapeDataIOImp
<
GridType
::
dimension
,
GridType
::
dimensionworld
,
GridType
,
hasBackupRestore
>::
readGrid
(
grid
,
fnprefix
,
time
,
timestep
);
}
//! get Grid from file with time and timestep , return true if ok
inline
GridType
*
restoreGrid
(
const
GrapeIOStringType
fnprefix
,
double
&
time
,
int
timestep
)
{
const
bool
hasBackupRestore
=
Capabilities
::
hasBackupRestoreFacilities
<
GridType
>::
v
;
return
GrapeDataIOImp
<
GridType
::
dimension
,
GridType
::
dimensionworld
,
GridType
,
hasBackupRestore
>::
restoreGrid
(
fnprefix
,
time
,
timestep
);
}
/**
...
...
@@ -153,9 +180,8 @@ namespace Dune {
const
GrapeIOStringType
filename
,
int
timestep
);
};
template
<
int
dim
,
int
dimworld
,
class
GridImp
>
inline
bool
GrapeDataIOImp
<
dim
,
dimworld
,
GridImp
>
::
writeGrid
template
<
int
dim
,
int
dimworld
,
class
GridImp
,
bool
hasBackupRestore
>
inline
bool
GrapeDataIOImp
<
dim
,
dimworld
,
GridImp
,
hasBackupRestore
>
::
writeGrid
(
const
GridImp
&
grid
,
const
GrapeIOFileFormatType
ftype
,
const
GrapeIOStringType
&
fnprefix
,
double
time
,
int
timestep
,
int
precision
)
...
...
@@ -188,6 +214,7 @@ namespace Dune {
{
case
xdr
:
return
grid
.
template
writeGrid
<
xdr
>
(
fnstr
,
time
);
case
ascii
:
return
grid
.
template
writeGrid
<
ascii
>(
fnstr
,
time
);
//case xdr : return grid.writeGrid(xdr,fnstr,time);
default
:
{
std
::
cerr
<<
ftype
<<
" GrapeIOFileFormatType not supported at the moment! "
<<
__FILE__
<<
__LINE__
<<
"
\n
"
;
...
...
@@ -202,8 +229,8 @@ namespace Dune {
}
template
<
int
dim
,
int
dimworld
,
class
GridImp
>
inline
bool
GrapeDataIOImp
<
dim
,
dimworld
,
GridImp
>
::
readGrid
template
<
int
dim
,
int
dimworld
,
class
GridImp
,
bool
hasBackupRestore
>
inline
bool
GrapeDataIOImp
<
dim
,
dimworld
,
GridImp
,
hasBackupRestore
>
::
readGrid
(
GridImp
&
grid
,
const
GrapeIOStringType
&
fnprefix
,
double
&
time
,
int
timestep
)
{
int
helpType
;
...
...
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