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
dg
dg
Commits
304f7071
Commit
304f7071
authored
Jun 06, 2017
by
Jonathan Lambrechts
Browse files
fix1
parent
d309afee
Pipeline
#2086
failed with stage
in 52 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
mesh/dgMesh.cpp
View file @
304f7071
...
...
@@ -456,8 +456,10 @@ static void loadMSH2(const char *fileName, std::ifstream &input, LoadMesh &mesh,
static
void
loadMSH3
(
const
char
*
fileName
,
std
::
ifstream
&
input
,
LoadMesh
&
mesh
,
bool
sequentialLoad
)
{
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
std
::
string
line
;
if
(
!
(
input
>>
line
))
ferror
;
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
if
(
line
==
"$PhysicalNames"
){
int
nphys
;
if
(
!
(
input
>>
nphys
))
ferror
;
...
...
@@ -475,6 +477,7 @@ static void loadMSH3(const char *fileName, std::ifstream &input, LoadMesh &mesh,
if
(
!
(
input
>>
line
))
ferror
;
if
(
line
!=
"$EndPhysicalNames"
)
ferror
;
}
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
if
(
!
(
input
>>
line
))
ferror
;
if
(
line
!=
"$Entities"
)
ferror
;
int
nent
[
4
];
...
...
@@ -494,7 +497,9 @@ static void loadMSH3(const char *fileName, std::ifstream &input, LoadMesh &mesh,
getline
(
input
,
line
);
}
}
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
getline
(
input
,
line
);
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
if
(
line
!=
"$EndEntities"
)
ferror
;
getline
(
input
,
line
);
if
(
line
!=
"$Nodes"
)
ferror
;
...
...
@@ -541,9 +546,12 @@ static void loadMSH3(const char *fileName, std::ifstream &input, LoadMesh &mesh,
keep
|=
(
tmp
-
1
==
Msg
::
GetCommRank
());
}
}
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
if
(
fs
->
dimension
>
mesh
.
dimension
)
mesh
.
dimension
=
fs
->
dimension
;
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
evertices
.
reserve
(
nNodes
);
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
for
(
int
j
=
0
;
j
<
nNodes
;
++
j
)
{
Vertex
&
v
=
vmap
[
tags
[
j
]];
if
(
v
.
id
==
-
1
&&
keep
)
...
...
@@ -555,9 +563,11 @@ static void loadMSH3(const char *fileName, std::ifstream &input, LoadMesh &mesh,
mesh
.
elements
[
key
].
push_back
(
MElement
(
evertices
,
num
));
}
}
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
if
(
!
(
input
>>
line
))
ferror
;
if
(
line
!=
"$EndElements"
)
ferror
;
mesh
.
nodes
.
resize
(
cid
,
3
);
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
for
(
auto
&
it
:
vmap
)
{
Vertex
&
v
=
it
.
second
;
if
(
v
.
id
!=
-
1
)
{
...
...
@@ -567,6 +577,7 @@ static void loadMSH3(const char *fileName, std::ifstream &input, LoadMesh &mesh,
mesh
.
nodes
(
v
.
id
,
2
)
=
v
.
z
;
}
}
printf
(
"loading mesh format 3 %i
\n
"
,
__line__
);
}
static
void
loadMSH
(
const
char
*
fileName
,
LoadMesh
&
mesh
,
bool
sequentialLoad
)
...
...
@@ -608,15 +619,19 @@ static dgFullMatrix<double> copyCoordinates(const std::vector<MElement> &element
dgMesh
::
dgMesh
(
const
std
::
string
filename
,
int
dimension
,
const
std
::
vector
<
std
::
string
>
physicalTags
,
bool
sequentialLoad
,
const
std
::
string
periodicFile
)
{
printf
(
"loading mesh %i
\n
"
,
__line__
);
LoadMesh
mesh
;
_octree
=
NULL
;
sequentialLoad
|=
(
Msg
::
GetCommSize
()
==
1
);
_sequentialLoad
=
sequentialLoad
;
printf
(
"loading mesh %i
\n
"
,
__line__
);
loadMSH
(
filename
.
c_str
(),
mesh
,
sequentialLoad
);
printf
(
"loading mesh %i
\n
"
,
__line__
);
_spaceTransform
=
NULL
;
if
(
dimension
==
0
)
dimension
=
mesh
.
dimension
;
_dimension
=
dimension
;
printf
(
"loading mesh %i
\n
"
,
__line__
);
for
(
auto
&
it
:
mesh
.
elements
)
{
int
type
=
it
.
first
.
type
;
int
dim
=
ElementType
::
DimensionFromTag
(
type
);
...
...
@@ -625,10 +640,14 @@ dgMesh::dgMesh(const std::string filename, int dimension, const std::vector<std:
if
(
!
physicalTags
.
empty
()
&&
std
::
find
(
physicalTags
.
begin
(),
physicalTags
.
end
(),
tag
)
==
physicalTags
.
end
())
continue
;
int
iGroup
=
_elements
.
size
();
if
(
it
.
first
.
partition
!=
Msg
::
GetCommRank
())
continue
;
printf
(
"loading mesh %i
\n
"
,
__line__
);
_elements
.
push_back
(
new
dgElementVector
(
iGroup
,
it
.
second
,
tag
,
type
,
copyCoordinates
(
it
.
second
,
mesh
.
nodes
),
it
.
first
.
partition
));
printf
(
"loading mesh %i
\n
"
,
__line__
);
for
(
size_t
i
=
0
;
i
<
it
.
second
.
size
();
++
i
)
_elementMap
[
it
.
second
[
i
].
num
()]
=
std
::
make_pair
(
iGroup
,
i
);
printf
(
"loading mesh %i
\n
"
,
__line__
);
}
printf
(
"loading mesh %i
\n
"
,
__line__
);
for
(
auto
&
it
:
mesh
.
elements
)
{
int
type
=
it
.
first
.
type
;
int
dim
=
ElementType
::
DimensionFromTag
(
type
);
...
...
@@ -637,16 +656,21 @@ dgMesh::dgMesh(const std::string filename, int dimension, const std::vector<std:
if
(
!
physicalTags
.
empty
()
&&
std
::
find
(
physicalTags
.
begin
(),
physicalTags
.
end
(),
tag
)
==
physicalTags
.
end
())
continue
;
int
iGroup
=
_elements
.
size
()
+
_ghostElements
.
size
();
if
(
it
.
first
.
partition
==
Msg
::
GetCommRank
())
continue
;
printf
(
"loading mesh %i
\n
"
,
__line__
);
_ghostElements
.
push_back
(
new
dgElementVector
(
iGroup
,
it
.
second
,
tag
,
type
,
copyCoordinates
(
it
.
second
,
mesh
.
nodes
),
it
.
first
.
partition
));
printf
(
"loading mesh %i
\n
"
,
__line__
);
for
(
size_t
i
=
0
;
i
<
it
.
second
.
size
();
++
i
)
_elementMap
[
it
.
second
[
i
].
num
()]
=
std
::
make_pair
(
iGroup
,
i
);
}
printf
(
"loading mesh %i
\n
"
,
__line__
);
if
(
_elements
.
size
()
==
0
)
Msg
::
Fatal
(
"no element loaded in dgMesh !"
);
_gmshVertexId
.
resize
(
mesh
.
mshToVertexId
.
size
());
for
(
auto
it
:
mesh
.
mshToVertexId
)
_gmshVertexId
[
it
.
second
]
=
it
.
first
;
printf
(
"loading mesh %i
\n
"
,
__line__
);
buildInterfaces
(
*
this
,
mesh
,
_interfaces
,
_interfaceMap
,
_periodicMap
,
sequentialLoad
,
periodicFile
);
printf
(
"loading mesh %i
\n
"
,
__line__
);
}
void
dgMesh
::
findElement
(
int
mElementId
,
int
&
iGroup
,
int
&
iElement
)
const
...
...
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