Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
61010438
Commit
61010438
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
f3cd230b
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
Geo/GModelIO_MED.cpp
+23
-15
23 additions, 15 deletions
Geo/GModelIO_MED.cpp
with
23 additions
and
15 deletions
Geo/GModelIO_MED.cpp
+
23
−
15
View file @
61010438
// $Id: GModelIO_MED.cpp,v 1.1
2
2008-03-2
3 22:14:02
geuzaine Exp $
// $Id: GModelIO_MED.cpp,v 1.1
3
2008-03-2
4 06:39:13
geuzaine Exp $
//
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include
<map>
#include
<map>
#include
<sstream>
#include
<sstream>
#include
<vector>
#include
<vector>
#include
<cstring>
#include
"MElement.h"
#include
"MElement.h"
#include
"MVertex.h"
#include
"MVertex.h"
...
@@ -254,7 +255,8 @@ int GModel::readMED(const std::string &name)
...
@@ -254,7 +255,8 @@ int GModel::readMED(const std::string &name)
return
0
;
return
0
;
}
}
if
(
numMeshes
>
1
)
if
(
numMeshes
>
1
)
Msg
(
WARNING
,
"There are %d meshes in the MED file: reading only the first"
);
Msg
(
WARNING
,
"There are %d meshes in the MED file: reading only the first"
,
numMeshes
);
// read mesh info
// read mesh info
char
meshName
[
MED_TAILLE_NOM
+
1
],
meshDesc
[
MED_TAILLE_DESC
+
1
];
char
meshName
[
MED_TAILLE_NOM
+
1
],
meshDesc
[
MED_TAILLE_DESC
+
1
];
...
@@ -264,11 +266,15 @@ int GModel::readMED(const std::string &name)
...
@@ -264,11 +266,15 @@ int GModel::readMED(const std::string &name)
Msg
(
GERROR
,
"Unable to read mesh information"
);
Msg
(
GERROR
,
"Unable to read mesh information"
);
return
0
;
return
0
;
}
}
if
(
meshType
!=
MED_NON_STRUCTURE
||
meshDim
!=
3
){
Msg
(
GERROR
,
"Cannot read structured and/or non 3-D mesh"
);
if
(
meshType
==
MED_NON_STRUCTURE
){
Msg
(
INFO
,
"Reading %d-D unstructured mesh <<%s>>"
,
meshDim
,
meshName
);
}
else
{
Msg
(
GERROR
,
"Cannot read structured mesh"
);
return
0
;
return
0
;
}
}
// read nodes
// read nodes
med_int
numNodes
=
MEDnEntMaa
(
fid
,
meshName
,
MED_COOR
,
MED_NOEUD
,
med_int
numNodes
=
MEDnEntMaa
(
fid
,
meshName
,
MED_COOR
,
MED_NOEUD
,
(
med_geometrie_element
)
0
,
(
med_connectivite
)
0
);
(
med_geometrie_element
)
0
,
(
med_connectivite
)
0
);
...
@@ -281,25 +287,27 @@ int GModel::readMED(const std::string &name)
...
@@ -281,25 +287,27 @@ int GModel::readMED(const std::string &name)
return
0
;
return
0
;
}
}
std
::
vector
<
MVertex
*>
verts
(
numNodes
);
std
::
vector
<
MVertex
*>
verts
(
numNodes
);
std
::
vector
<
med_float
>
coord
(
3
*
numNodes
);
std
::
vector
<
med_float
>
coord
(
meshDim
*
numNodes
);
char
coordName
[
3
*
MED_TAILLE_PNOM
+
1
],
coordUnit
[
3
*
MED_TAILLE_PNOM
+
1
];
std
::
vector
<
char
>
coordName
(
meshDim
*
MED_TAILLE_PNOM
+
1
);
std
::
vector
<
char
>
coordUnit
(
meshDim
*
MED_TAILLE_PNOM
+
1
);
med_repere
rep
;
med_repere
rep
;
if
(
MEDcoordLire
(
fid
,
meshName
,
meshDim
,
&
coord
[
0
],
MED_FULL_INTERLACE
,
if
(
MEDcoordLire
(
fid
,
meshName
,
meshDim
,
&
coord
[
0
],
MED_FULL_INTERLACE
,
MED_ALL
,
0
,
0
,
&
rep
,
coordName
,
coordUnit
)
<
0
){
MED_ALL
,
0
,
0
,
&
rep
,
&
coordName
[
0
]
,
&
coordUnit
[
0
]
)
<
0
){
Msg
(
GERROR
,
"Could not read node coordinates"
);
Msg
(
GERROR
,
"Could not read
MED
node coordinates"
);
return
0
;
return
0
;
}
}
std
::
vector
<
med_int
>
nodeTags
(
numNodes
);
std
::
vector
<
med_int
>
nodeTags
(
numNodes
);
if
(
MEDnumLire
(
fid
,
meshName
,
&
nodeTags
[
0
],
numNodes
,
MED_NOEUD
,
if
(
MEDnumLire
(
fid
,
meshName
,
&
nodeTags
[
0
],
numNodes
,
MED_NOEUD
,
(
med_geometrie_element
)
0
)
<
0
)
(
med_geometrie_element
)
0
)
<
0
)
nodeTags
.
clear
();
nodeTags
.
clear
();
for
(
int
i
=
0
;
i
<
numNodes
;
i
++
){
for
(
int
i
=
0
;
i
<
numNodes
;
i
++
)
verts
[
i
]
=
new
MVertex
(
coord
[
3
*
i
],
coord
[
3
*
i
+
1
],
coord
[
3
*
i
+
2
],
verts
[
i
]
=
new
MVertex
(
coord
[
meshDim
*
i
],
(
meshDim
>
1
)
?
coord
[
meshDim
*
i
+
1
]
:
0.
,
(
meshDim
>
2
)
?
coord
[
meshDim
*
i
+
2
]
:
0.
,
0
,
nodeTags
.
empty
()
?
0
:
nodeTags
[
i
]);
0
,
nodeTags
.
empty
()
?
0
:
nodeTags
[
i
]);
}
// read elements
// read elements
for
(
int
mshType
=
0
;
mshType
<
10
0
;
mshType
++
){
// loop over all possible MSH types
for
(
int
mshType
=
0
;
mshType
<
5
0
;
mshType
++
){
// loop over all possible MSH types
med_geometrie_element
type
;
med_geometrie_element
type
;
int
numNodPerEle
=
getTypeForMED
(
mshType
,
type
);
int
numNodPerEle
=
getTypeForMED
(
mshType
,
type
);
if
(
type
==
MED_NONE
)
continue
;
if
(
type
==
MED_NONE
)
continue
;
...
@@ -343,7 +351,7 @@ int GModel::readMED(const std::string &name)
...
@@ -343,7 +351,7 @@ int GModel::readMED(const std::string &name)
Msg
(
GERROR
,
"Could not read MED families"
);
Msg
(
GERROR
,
"Could not read MED families"
);
return
0
;
return
0
;
}
}
for
(
int
i
=
0
;
i
<
numFamilies
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numFamilies
;
i
++
)
{
med_int
numAttrib
=
MEDnAttribut
(
fid
,
meshName
,
i
+
1
);
med_int
numAttrib
=
MEDnAttribut
(
fid
,
meshName
,
i
+
1
);
med_int
numGroups
=
MEDnGroupe
(
fid
,
meshName
,
i
+
1
);
med_int
numGroups
=
MEDnGroupe
(
fid
,
meshName
,
i
+
1
);
if
(
numAttrib
<
0
||
numGroups
<
0
){
if
(
numAttrib
<
0
||
numGroups
<
0
){
...
@@ -363,7 +371,7 @@ int GModel::readMED(const std::string &name)
...
@@ -363,7 +371,7 @@ int GModel::readMED(const std::string &name)
Msg
(
GERROR
,
"Could not read info for MED family %d"
,
i
+
1
);
Msg
(
GERROR
,
"Could not read info for MED family %d"
,
i
+
1
);
}
}
else
{
else
{
GEntity
*
ge
;
GEntity
*
ge
;
// family tags are unique (for all dims)
if
((
ge
=
getRegionByTag
(
-
familyNum
))){}
if
((
ge
=
getRegionByTag
(
-
familyNum
))){}
else
if
((
ge
=
getFaceByTag
(
-
familyNum
))){}
else
if
((
ge
=
getFaceByTag
(
-
familyNum
))){}
else
if
((
ge
=
getEdgeByTag
(
-
familyNum
))){}
else
if
((
ge
=
getEdgeByTag
(
-
familyNum
))){}
...
...
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