Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MoReFEM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
MoReFEM
CoreLibrary
MoReFEM
Commits
5342d900
Commit
5342d900
authored
5 years ago
by
GILLES Sebastien
Browse files
Options
Downloads
Patches
Plain Diff
#0 Minor modifications during review (mostly about types).
parent
51470460
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
Sources/ThirdParty/Wrappers/Petsc/Vector/Internal/VectorHelper.cpp
+2
-2
2 additions, 2 deletions
...hirdParty/Wrappers/Petsc/Vector/Internal/VectorHelper.cpp
Sources/Utilities/OutputFormat/ReadBinaryFile.cpp
+12
-12
12 additions, 12 deletions
Sources/Utilities/OutputFormat/ReadBinaryFile.cpp
with
14 additions
and
14 deletions
Sources/ThirdParty/Wrappers/Petsc/Vector/Internal/VectorHelper.cpp
+
2
−
2
View file @
5342d900
...
...
@@ -62,7 +62,7 @@ namespace MoReFEM
const
auto
Nbits
=
Nvalue
*
sizeof
(
double
);
std
::
vector
<
char
>
binary_values
(
Nbits
);
std
::
memcpy
(
binary_values
.
data
(),
array
,
Nbits
);
out
.
write
(
binary_values
.
data
(),
static_cast
<
long
>
(
Nbits
));
out
.
write
(
binary_values
.
data
(),
static_cast
<
std
::
streamsize
>
(
Nbits
));
out
.
close
();
break
;
}
...
...
@@ -83,7 +83,7 @@ namespace MoReFEM
}
case
binary_or_ascii
::
from_input_data
:
{
assert
(
false
&&
"This function should be called from Vector class, and this specific case "
assert
(
false
&&
"This function should be called from Vector class, and this specific case "
"should have been addressed prior to this call (see Vector::Print() for instance "
"to see how)."
);
exit
(
EXIT_FAILURE
);
...
...
This diff is collapsed.
Click to expand it.
Sources/Utilities/OutputFormat/ReadBinaryFile.cpp
+
12
−
12
View file @
5342d900
...
...
@@ -33,14 +33,16 @@ namespace MoReFEM::Advanced
if
(
in
)
{
// Get length of file.
std
::
ifstream
::
pos_type
block_size
;
block_size
=
in
.
seekg
(
0
,
std
::
ifstream
::
end
).
tellg
();
std
::
ifstream
::
pos_type
block_size
_helper
;
block_size
_helper
=
in
.
seekg
(
0
,
std
::
ifstream
::
end
).
tellg
();
in
.
seekg
(
0
,
std
::
ifstream
::
beg
);
std
::
vector
<
char
>
buffer
(
static_cast
<
std
::
size_t
>
(
block_size
));
const
auto
block_size
=
static_cast
<
std
::
size_t
>
(
block_size_helper
);
std
::
vector
<
char
>
buffer
(
block_size
);
// Read data as a block.
in
.
read
(
buffer
.
data
(),
block_size
);
in
.
read
(
buffer
.
data
(),
block_size
_helper
);
if
(
!
in
)
throw
Exception
(
"Unable to read file "
+
binary_file
,
invoking_file
,
invoking_line
);
...
...
@@ -48,16 +50,14 @@ namespace MoReFEM::Advanced
in
.
close
();
// Buffer contains the entire file. Convert bytes back into doubles.
const
unsigned
long
Ndouble_values
=
static_cast
<
std
::
size_t
>
(
block_size
)
/
sizeof
(
double
);
std
::
vector
<
double
>
values
(
Ndouble_values
);
std
::
memcpy
(
values
.
data
(),
buffer
.
data
(),
static_cast
<
std
::
size_t
>
(
block_size
)
)
;
const
auto
Ndouble_values
=
static_cast
<
std
::
size_t
>
(
block_size
)
/
sizeof
(
double
);
ret
.
resize
(
Ndouble_values
);
std
::
memcpy
(
ret
.
data
(),
buffer
.
data
(),
block_size
);
for
(
std
::
size_t
i
=
0u
;
i
<
Ndouble_values
;
++
i
)
for
(
auto
&
item
:
ret
)
{
if
(
std
::
fabs
(
values
[
i
])
<=
epsilon
)
ret
.
push_back
(
0.
);
else
ret
.
push_back
(
values
[
i
]);
if
(
std
::
fabs
(
item
)
<=
epsilon
)
item
=
0.
;
}
}
...
...
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