Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container 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
MostafaMollaali
dynamic
Commits
5715e46e
Commit
5715e46e
authored
8 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/IO/MPI_IO] Impl. PropertyVectorMetaData.
parent
2a9e3549
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
MeshLib/IO/MPI_IO/PropertyVectorMetaData.h
+136
-0
136 additions, 0 deletions
MeshLib/IO/MPI_IO/PropertyVectorMetaData.h
with
136 additions
and
0 deletions
MeshLib/IO/MPI_IO/PropertyVectorMetaData.h
0 → 100644
+
136
−
0
View file @
5715e46e
/**
* \file
*
* \copyright
* Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#pragma once
#include
<string>
#include
<boost/optional.hpp>
namespace
MeshLib
{
namespace
IO
{
struct
PropertyVectorMetaData
{
std
::
string
property_name
;
/// is_int_type is true if the type of the components is an integer type, if
/// it is a floating point number type the is_int_type is false
bool
is_int_type
;
/// if the component type is an integer number the flag is_data_type_signed
/// signals if it has a sign or not
bool
is_data_type_signed
;
unsigned
long
data_type_size_in_bytes
;
unsigned
long
number_of_components
;
unsigned
long
number_of_tuples
;
};
inline
void
writePropertyVectorMetaDataBinary
(
std
::
ostream
&
os
,
PropertyVectorMetaData
const
&
pvmd
)
{
std
::
string
::
size_type
s
(
pvmd
.
property_name
.
length
());
os
.
write
(
reinterpret_cast
<
char
*>
(
&
s
),
sizeof
(
std
::
string
::
size_type
));
os
.
write
(
const_cast
<
char
*>
(
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
property_name
.
data
()),
s
);
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
is_int_type
),
sizeof
(
bool
));
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
is_data_type_signed
),
sizeof
(
bool
));
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
data_type_size_in_bytes
),
sizeof
(
unsigned
long
));
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
number_of_components
),
sizeof
(
unsigned
long
));
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorMetaData
&>
(
pvmd
).
number_of_tuples
),
sizeof
(
unsigned
long
));
}
inline
void
writePropertyVectorMetaData
(
PropertyVectorMetaData
const
&
pvmd
)
{
DBUG
(
"size of name: %d"
,
pvmd
.
property_name
.
length
());
DBUG
(
"name: '%s'"
,
pvmd
.
property_name
.
c_str
());
DBUG
(
"is_int_data_type: %d"
,
pvmd
.
is_int_type
);
DBUG
(
"is_data_type_signed: %d"
,
pvmd
.
is_data_type_signed
);
DBUG
(
"data_type_size_in_bytes: %d"
,
pvmd
.
data_type_size_in_bytes
);
DBUG
(
"number of components: i%d"
,
pvmd
.
number_of_components
);
DBUG
(
"number of tuples: %d"
,
pvmd
.
number_of_tuples
);
}
inline
boost
::
optional
<
PropertyVectorMetaData
>
readPropertyVectorMetaData
(
std
::
istream
&
is
)
{
// read the size of the name of the PropertyVector
std
::
string
::
size_type
s
=
0
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
s
),
sizeof
(
std
::
string
::
size_type
)))
return
boost
::
optional
<
PropertyVectorMetaData
>
();
PropertyVectorMetaData
pvmd
;
char
*
dummy
=
new
char
[
s
];
if
(
!
is
.
read
(
dummy
,
s
))
return
boost
::
none
;
pvmd
.
property_name
=
std
::
string
(
dummy
,
s
);
delete
[]
dummy
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvmd
.
is_int_type
),
sizeof
(
bool
)))
return
boost
::
none
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvmd
.
is_data_type_signed
),
sizeof
(
bool
)))
return
boost
::
none
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvmd
.
data_type_size_in_bytes
),
sizeof
(
unsigned
long
)))
return
boost
::
none
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvmd
.
number_of_components
),
sizeof
(
unsigned
long
)))
return
boost
::
none
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvmd
.
number_of_tuples
),
sizeof
(
unsigned
long
)))
return
boost
::
none
;
return
boost
::
optional
<
PropertyVectorMetaData
>
(
pvmd
);
}
struct
PropertyVectorPartitionMetaData
{
unsigned
long
offset
;
unsigned
long
number_of_tuples
;
};
inline
void
writePropertyVectorPartitionMetaData
(
std
::
ostream
&
os
,
PropertyVectorPartitionMetaData
const
&
pvpmd
)
{
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorPartitionMetaData
&>
(
pvpmd
)
.
offset
),
sizeof
(
unsigned
long
));
os
.
write
(
reinterpret_cast
<
char
*>
(
&
const_cast
<
PropertyVectorPartitionMetaData
&>
(
pvpmd
)
.
number_of_tuples
),
sizeof
(
unsigned
long
));
}
inline
boost
::
optional
<
PropertyVectorPartitionMetaData
>
readPropertyVectorPartitionMetaData
(
std
::
istream
&
is
)
{
PropertyVectorPartitionMetaData
pvpmd
;
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvpmd
.
offset
),
sizeof
(
unsigned
long
)))
return
boost
::
optional
<
PropertyVectorPartitionMetaData
>
();
if
(
!
is
.
read
(
reinterpret_cast
<
char
*>
(
&
pvpmd
.
number_of_tuples
),
sizeof
(
unsigned
long
)))
return
boost
::
optional
<
PropertyVectorPartitionMetaData
>
();
return
boost
::
optional
<
PropertyVectorPartitionMetaData
>
(
pvpmd
);
}
}
}
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