Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
feature-adiosWrite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Community
feature-adiosWrite
Commits
7a77ef7e
Commit
7a77ef7e
authored
8 years ago
by
mark
Browse files
Options
Downloads
Patches
Plain Diff
ENH: support more types in adiosTraits
parent
183f89e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/adiosFoam/adiosTypes.C
+12
-27
12 additions, 27 deletions
src/adiosFoam/adiosTypes.C
src/adiosFoam/adiosTypes.H
+98
-14
98 additions, 14 deletions
src/adiosFoam/adiosTypes.H
with
110 additions
and
41 deletions
src/adiosFoam/adiosTypes.C
+
12
−
27
View file @
7a77ef7e
...
...
@@ -32,47 +32,30 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
#if WM_LABEL_SIZE == 32
const
enum
ADIOS_DATATYPES
Foam
::
adiosTraits
<
Foam
::
label
>::
adiosType
=
adios_integer
;
Foam
::
adiosTraits
<
int
>::
adiosType
=
adios_integer
;
const
size_t
Foam
::
adiosTraits
<
Foam
::
label
>::
adiosSize
=
4
;
#elif WM_LABEL_SIZE == 64
Foam
::
adiosTraits
<
int
>::
adiosSize
=
4
;
const
enum
ADIOS_DATATYPES
Foam
::
adiosTraits
<
Foam
::
label
>::
adiosType
=
adios_long
;
Foam
::
adiosTraits
<
long
>::
adiosType
=
adios_long
;
const
size_t
Foam
::
adiosTraits
<
Foam
::
label
>::
adiosSize
=
8
;
#else
#error "WM_LABEL_SIZE not defined in adiosTypes"
#endif
Foam
::
adiosTraits
<
long
>::
adiosSize
=
8
;
#if defined(WM_SP)
const
enum
ADIOS_DATATYPES
Foam
::
adiosTraits
<
Foam
::
scalar
>::
adiosType
=
adios_real
;
Foam
::
adiosTraits
<
float
>::
adiosType
=
adios_real
;
const
size_t
Foam
::
adiosTraits
<
Foam
::
scalar
>::
adiosSize
=
4
;
#elif defined(WM_DP)
Foam
::
adiosTraits
<
float
>::
adiosSize
=
4
;
const
enum
ADIOS_DATATYPES
Foam
::
adiosTraits
<
Foam
::
scalar
>::
adiosType
=
adios_double
;
Foam
::
adiosTraits
<
double
>::
adiosType
=
adios_double
;
const
size_t
Foam
::
adiosTraits
<
Foam
::
scalar
>::
adiosSize
=
8
;
#else
# error "(WM_SP | WM_DP) not defined in adiosTypes"
#endif
Foam
::
adiosTraits
<
double
>::
adiosSize
=
8
;
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
...
...
@@ -90,7 +73,8 @@ bool Foam::adiosTraits<Foam::label>::ok()
else
{
FatalErrorInFunction
<<
"Incorrect adios type/size for "
<<
pTraits
<
label
>::
typeName
<<
"Incorrect adios type/size for "
<<
pTraits
<
label
>::
typeName
<<
exit
(
FatalError
);
return
false
;
...
...
@@ -111,7 +95,8 @@ bool Foam::adiosTraits<Foam::scalar>::ok()
else
{
FatalErrorInFunction
<<
"Incorrect adios type/size for "
<<
pTraits
<
scalar
>::
typeName
<<
"Incorrect adios type/size for "
<<
pTraits
<
scalar
>::
typeName
<<
exit
(
FatalError
);
return
false
;
...
...
This diff is collapsed.
Click to expand it.
src/adiosFoam/adiosTypes.H
+
98
−
14
View file @
7a77ef7e
...
...
@@ -47,16 +47,58 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Template specialization for adiosTraits<
label
>
//- Template specialization for adiosTraits<
int
>
template
<
>
class
adiosTraits
<
label
>
class
adiosTraits
<
int
>
{
label
p_
;
int
p_
;
public:
//- ADIOS type
static
const
enum
ADIOS_DATATYPES
adiosType
;
//- Size of ADIOS type
static
const
size_t
adiosSize
;
//- Verify ADIOS type-size
static
bool
ok
();
// Constructors
//- Construct from primitive
explicit
adiosTraits
(
const
int
&
);
// Member Functions
//- Access to the primitive value
operator
int
()
const
{
return
p_
;
}
//- Access to the primitive value
operator
int
&
()
{
return
p_
;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Template specialization for adiosTraits<int>
template
<
>
class
adiosTraits
<
long
>
{
long
p_
;
public:
//- Component type
typedef
label
cmptType
;
//
typedef label cmptType;
//- ADIOS type
static
const
enum
ADIOS_DATATYPES
adiosType
;
...
...
@@ -71,19 +113,19 @@ public:
// Constructors
//- Construct from primitive
explicit
adiosTraits
(
const
l
abel
&
);
explicit
adiosTraits
(
const
l
ong
&
);
// Member Functions
//- Access to the primitive value
operator
l
abel
()
const
operator
l
ong
()
const
{
return
p_
;
}
//- Access to the primitive value
operator
l
abel
&
()
operator
l
ong
&
()
{
return
p_
;
}
...
...
@@ -92,16 +134,58 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Template specialization for adiosTraits<
scalar
>
//- Template specialization for adiosTraits<
float
>
template
<
>
class
adiosTraits
<
scalar
>
class
adiosTraits
<
float
>
{
scalar
p_
;
float
p_
;
public:
//- Component type
typedef
scalar
cmptType
;
// typedef scalar cmptType;
//- ADIOS type
static
const
enum
ADIOS_DATATYPES
adiosType
;
//- Size of ADIOS type
static
const
size_t
adiosSize
;
//- Verify ADIOS type-size
static
bool
ok
();
// Constructors
//- Construct from primitive
explicit
adiosTraits
(
const
float
&
);
// Member Functions
//- Access to the primitive value
operator
float
()
const
{
return
p_
;
}
//- Access to the primitive value
operator
float
&
()
{
return
p_
;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Template specialization for adiosTraits<double>
template
<
>
class
adiosTraits
<
double
>
{
double
p_
;
public:
//- ADIOS type
static
const
enum
ADIOS_DATATYPES
adiosType
;
...
...
@@ -116,19 +200,19 @@ public:
// Constructors
//- Construct from primitive
explicit
adiosTraits
(
const
scalar
&
);
explicit
adiosTraits
(
const
double
&
);
// Member Functions
//- Access to the primitive value
operator
scalar
()
const
operator
double
()
const
{
return
p_
;
}
//- Access to the primitive value
operator
scalar
&
()
operator
double
&
()
{
return
p_
;
}
...
...
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