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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
4b9c4af3
Commit
4b9c4af3
authored
21 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
Changed read and write default method of discrete functions.
[[Imported from SVN: r246]]
parent
2cb85c28
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
fem/common/discretefunction.cc
+27
-28
27 additions, 28 deletions
fem/common/discretefunction.cc
fem/common/discretefunction.hh
+1
-3
1 addition, 3 deletions
fem/common/discretefunction.hh
with
28 additions
and
31 deletions
fem/common/discretefunction.cc
+
27
−
28
View file @
4b9c4af3
...
...
@@ -251,10 +251,9 @@ namespace Dune
template
<
class
DiscreteFunctionSpaceType
,
class
DofIteratorImp
,
template
<
class
,
class
>
class
LocalFunctionIteratorImp
,
class
DiscreteFunctionImp
>
template
<
FileFormatType
ftype
>
inline
bool
DiscreteFunctionDefault
<
DiscreteFunctionSpaceType
,
DofIteratorImp
,
LocalFunctionIteratorImp
,
DiscreteFunctionImp
>::
write
(
const
char
*
filename
,
int
timestep
)
write
(
const
FileFormatType
ftype
,
const
char
*
filename
,
int
timestep
)
{
{
enum
{
n
=
DiscreteFunctionSpaceType
::
DimDomain
};
...
...
@@ -279,38 +278,34 @@ namespace Dune
template
<
class
DiscreteFunctionSpaceType
,
class
DofIteratorImp
,
template
<
class
,
class
>
class
LocalFunctionIteratorImp
,
class
DiscreteFunctionImp
>
template
<
FileFormatType
ftype
>
inline
bool
DiscreteFunctionDefault
<
DiscreteFunctionSpaceType
,
DofIteratorImp
,
LocalFunctionIteratorImp
,
DiscreteFunctionImp
>::
read
(
const
char
*
filename
,
int
timestep
)
{
enum
{
tn
=
DiscreteFunctionSpaceType
::
DimDomain
};
enum
{
tm
=
DiscreteFunctionSpaceType
::
DimRange
};
std
::
fstream
file
(
filename
,
std
::
ios
::
in
);
int
n
,
m
;
std
::
basic_string
<
char
>
r
,
d
;
std
::
basic_string
<
char
>
tr
(
typeIdentifier
<
RangeFieldType
>
());
std
::
basic_string
<
char
>
td
(
typeIdentifier
<
DomainFieldType
>
());
file
>>
d
;
file
>>
r
;
file
>>
n
>>
m
;
int
id
,
type
;
file
>>
id
>>
type
;
FileFormatType
ftype
=
static_cast
<
FileFormatType
>
(
type
);
if
((
d
!=
td
)
||
(
r
!=
tr
)
||
(
n
!=
tn
)
||
(
m
!=
tm
)
)
{
enum
{
tn
=
DiscreteFunctionSpaceType
::
DimDomain
};
enum
{
tm
=
DiscreteFunctionSpaceType
::
DimRange
};
std
::
fstream
file
(
filename
,
std
::
ios
::
in
);
int
n
,
m
;
std
::
basic_string
<
char
>
r
,
d
;
std
::
basic_string
<
char
>
tr
(
typeIdentifier
<
RangeFieldType
>
());
std
::
basic_string
<
char
>
td
(
typeIdentifier
<
DomainFieldType
>
());
file
>>
d
;
file
>>
r
;
file
>>
n
>>
m
;
int
id
,
type
;
file
>>
id
>>
type
;
FileFormatType
ft
=
static_cast
<
FileFormatType
>
(
type
);
if
((
d
!=
td
)
||
(
r
!=
tr
)
||
(
n
!=
tn
)
||
(
m
!=
tm
)
||
(
ft
!=
ftype
)
)
{
std
::
cerr
<<
d
<<
" | "
<<
td
<<
" DomainField in read!
\n
"
;
std
::
cerr
<<
r
<<
" | "
<<
tr
<<
" RangeField in read!
\n
"
;
std
::
cerr
<<
n
<<
" | "
<<
tn
<<
" in read!
\n
"
;
std
::
cerr
<<
m
<<
" | "
<<
tm
<<
" in read!
\n
"
;
std
::
cerr
<<
ftype
<<
" Wrong FileFormat!
\n
"
;
std
::
cerr
<<
"Can not initialize DiscreteFunction with wrong FunctionSpace!
\n
"
;
abort
();
}
file
.
close
();
std
::
cerr
<<
d
<<
" | "
<<
td
<<
" DomainField in read!
\n
"
;
std
::
cerr
<<
r
<<
" | "
<<
tr
<<
" RangeField in read!
\n
"
;
std
::
cerr
<<
n
<<
" | "
<<
tn
<<
" in read!
\n
"
;
std
::
cerr
<<
m
<<
" | "
<<
tm
<<
" in read!
\n
"
;
std
::
cerr
<<
"Can not initialize DiscreteFunction with wrong FunctionSpace!
\n
"
;
abort
();
}
file
.
close
();
if
(
ftype
==
xdr
)
return
asImp
().
read_xdr
(
filename
,
timestep
);
...
...
@@ -318,6 +313,10 @@ namespace Dune
return
asImp
().
read_ascii
(
filename
,
timestep
);
if
(
ftype
==
pgm
)
return
asImp
().
read_pgm
(
filename
,
timestep
);
std
::
cerr
<<
ftype
<<
" FileFormatType not supported at the moment!
\n
"
;
abort
();
return
false
;
};
...
...
This diff is collapsed.
Click to expand it.
fem/common/discretefunction.hh
+
1
−
3
View file @
4b9c4af3
...
...
@@ -217,11 +217,9 @@ namespace Dune {
//! write disc func information file and write dofs to file+timestep
//! this method use the write method of the implementation of the
//! discrete function
template
<
FileFormatType
ftype
>
bool
write
(
const
char
*
filename
,
int
timestep
);
bool
write
(
const
FileFormatType
ftype
,
const
char
*
filename
,
int
timestep
);
//! same as write only read
template
<
FileFormatType
ftype
>
bool
read
(
const
char
*
filename
,
int
timestep
);
private
:
...
...
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