Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
dune-gmsh4
Commits
30578ed9
Commit
30578ed9
authored
Sep 21, 2020
by
Praetorius, Simon
Browse files
some cleanup
parent
4ead06db
Pipeline
#4833
failed with stage
in 7 minutes and 58 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dune/gmsh4/CMakeLists.txt
View file @
30578ed9
...
...
@@ -4,8 +4,8 @@ dune_add_library("gmsh4types" OBJECT
#install headers
install
(
FILES
filereader.hh
reader.hh
reader.impl.hh
gmsh4
reader.hh
gmsh4
reader.impl.hh
gridcreatorinterface.hh
types.hh
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dune/gmsh4
)
...
...
dune/gmsh4/gmsh4reader.hh
View file @
30578ed9
...
...
@@ -19,10 +19,12 @@ namespace Dune
*
* \tparam Grid Type of the grid to construct.
* \tparam GridCreator Policy type to control what to pass to a grid factory with
* data given from the file. [ContinuousGridCreator]
* data given from the file. See \ref GridCreatorInterface
* [ContinuousGridCreator]
* \tparam SizeType Data type for indices in the .msh file. Should match in size
* the `data_size` information in the header of the .msh file.
* This type is used for the internal data in the caches. [std::size_t]
* This type is used for the internal data in the caches.
* [std::size_t]
**/
template
<
class
Grid
,
class
GridCreator
=
Gmsh4
::
ContinuousGridCreator
<
Grid
>,
class
SizeType
=
std
::
size_t
>
class
Gmsh4Reader
...
...
@@ -132,14 +134,14 @@ namespace Dune
{
bool
result
=
line
.
substr
(
1
,
key
.
length
())
==
key
;
if
(
result
&&
current
!=
parent
)
DUNE_THROW
(
Exception
,
"<"
<<
key
<<
"> in wrong section."
);
DUNE_THROW
(
Dune
::
Exception
,
"<"
<<
key
<<
"> in wrong section."
);
return
result
;
}
void
readString
(
std
::
istream
&
stream
,
std
::
string
&
name
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Method readString() not yet implemented"
);
name
=
"
Hallo
"
;
name
=
""
;
}
// clear all vectors
...
...
dune/gmsh4/gmsh4reader.impl.hh
View file @
30578ed9
#include
<array>
#include
<sstream>
#include
<fstream>
#include
<iterator>
#include
<string>
#include
<set>
#include
<dune/common/classname.hh>
#include
<dune/common/version.hh>
#include
<dune/gmsh4/utility/errors.hh>
#include
<dune/gmsh4/utility/filesystem.hh>
#include
<dune/gmsh4/utility/string.hh>
...
...
@@ -16,7 +14,8 @@ inline void swapBytes (char *array, int size)
{
char
*
tmp
=
new
char
[
size
];
memcpy
(
tmp
,
array
,
size
);
for
(
int
c
=
0
;
c
<
size
;
++
c
)
array
[
size
-
1
-
c
]
=
tmp
[
c
];
for
(
int
c
=
0
;
c
<
size
;
++
c
)
array
[
size
-
1
-
c
]
=
tmp
[
c
];
delete
[]
tmp
;
}
...
...
@@ -265,7 +264,7 @@ template <class G, class C, class S>
template
<
class
T
>
void
Gmsh4Reader
<
G
,
C
,
S
>::
readValueBinary
(
std
::
ifstream
&
input
,
T
&
v
)
{
const
size_t
size
=
sizeof
(
T
);
const
std
::
size_t
size
=
sizeof
(
T
);
input
.
read
(
reinterpret_cast
<
char
*>
(
&
v
),
size
);
if
(
swap
)
swapBytes
(
reinterpret_cast
<
char
*>
(
&
v
),
size
);
}
...
...
dune/gmsh4/gridcreatorinterface.hh
View file @
30578ed9
...
...
@@ -2,9 +2,9 @@
#include
<cstdint>
#include
<string>
#include
<tuple>
#include
<vector>
#include
<dune/common/version.hh>
#include
<dune/grid/common/gridfactory.hh>
namespace
Dune
...
...
dune/gmsh4/gridcreators/continuousgridcreator.hh
View file @
30578ed9
...
...
@@ -11,6 +11,7 @@
#include
<dune/gmsh4/types.hh>
#include
<dune/gmsh4/gridcreatorinterface.hh>
#include
<dune/gmsh4/utilities/errors.hh>
namespace
Dune
{
...
...
@@ -75,7 +76,7 @@ namespace Dune
connectivity
.
resize
(
refElem
.
size
(
Grid
::
dimension
));
for
(
auto
const
&
element
:
entityBlock
.
elements
)
{
assert
(
element
.
nodes
.
size
()
>=
connectivity
.
size
());
GMSH4_ASSERT
(
element
.
nodes
.
size
()
>=
connectivity
.
size
());
for
(
std
::
size_t
j
=
0
;
j
<
connectivity
.
size
();
++
j
)
{
auto
index
=
vertexMap_
[
element
.
nodes
[
j
]
-
vertexShift_
];
auto
&
vertex
=
cornerVertices
.
at
(
index
);
...
...
dune/gmsh4/gridcreators/lagrangegridcreator.hh
View file @
30578ed9
...
...
@@ -15,6 +15,7 @@
#include
<dune/gmsh4/types.hh>
#include
<dune/gmsh4/gridcreatorinterface.hh>
#include
<dune/gmsh4/utility/errors.hh>
#include
<dune/gmsh4/utility/lagrangepoints.hh>
namespace
Dune
...
...
@@ -114,7 +115,7 @@ namespace Dune
connectivity
.
resize
(
refElem
.
size
(
dim
));
for
(
auto
const
&
element
:
entityBlock
.
elements
)
{
assert
(
element
.
nodes
.
size
()
>=
connectivity
.
size
());
GMSH4_ASSERT
(
element
.
nodes
.
size
()
>=
connectivity
.
size
());
for
(
std
::
size_t
j
=
0
;
j
<
connectivity
.
size
();
++
j
)
{
auto
index
=
vertexMap_
[
element
.
nodes
[
j
]
-
vertexShift_
];
auto
&
vertex
=
cornerVertices
.
at
(
index
);
...
...
@@ -182,7 +183,7 @@ namespace Dune
unsigned
int
insertionIndex
=
factory
().
insertionIndex
(
element
);
auto
const
&
localParam
=
parametrization_
.
at
(
insertionIndex
);
assert
(
element
.
type
()
==
localParam
.
type
);
GMSH4_ASSERT
(
element
.
type
()
==
localParam
.
type
);
// collect indices of vertices
std
::
vector
<
unsigned
int
>
indices
(
element
.
subEntities
(
GridType
::
dimension
));
...
...
@@ -193,7 +194,7 @@ namespace Dune
std
::
vector
<
unsigned
int
>
permutation
(
indices
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
indices
.
size
();
++
i
)
{
auto
it
=
std
::
find
(
localParam
.
corners
.
begin
(),
localParam
.
corners
.
end
(),
indices
[
i
]);
assert
(
it
!=
localParam
.
corners
.
end
());
GMSH4_ASSERT
(
it
!=
localParam
.
corners
.
end
());
permutation
[
i
]
=
std
::
distance
(
localParam
.
corners
.
begin
(),
it
);
}
...
...
@@ -216,7 +217,7 @@ namespace Dune
/// Determine lagrange order from number of points from the first element parametrization
int
order
()
const
{
assert
(
!
parametrization_
.
empty
());
GMSH4_ASSERT
(
!
parametrization_
.
empty
());
return
order
(
parametrization_
.
front
());
}
...
...
@@ -247,7 +248,7 @@ namespace Dune
friend
LocalFunction
localFunction
(
LagrangeGridCreator
&&
gridCreator
)
{
DUNE_THROW
(
Dune
::
Exception
,
"Cannot pass temporary LagrangeGridCreator to localFunction(). Pass an lvalue-reference instead."
);
DUNE_THROW
(
Dune
::
Gmsh4Error
,
"Cannot pass temporary LagrangeGridCreator to localFunction(). Pass an lvalue-reference instead."
);
return
LocalFunction
{
gridCreator
};
}
...
...
@@ -329,7 +330,7 @@ namespace Dune
LocalBasis
const
&
localBasis
=
localFE_
.
localBasis
();
localBasis
.
evaluateFunction
(
x
,
shapeValues_
);
assert
(
shapeValues_
.
size
()
==
localNodes_
.
size
());
GMSH4_ASSERT
(
shapeValues_
.
size
()
==
localNodes_
.
size
());
GlobalCoordinate
out
(
0
);
for
(
std
::
size_t
i
=
0
;
i
<
shapeValues_
.
size
();
++
i
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment