137 bool is_non_manifold =
false;
139 is_non_manifold =
mesh->meshKind().isNonManifold();
150 type->setInfos(
this, IT_NullType,
"NullType", Dimension::DimUnknown, 0, 0, 0);
158 type->setInfos(
this, IT_Vertex,
"Vertex", Dimension::Dim0, 0, 0, 0);
169 type->setInfos(
this, IT_FaceVertex,
"FaceVertex", Dimension::Dim0, 1, 0, 0);
178 type->setInfos(
this, IT_Line2,
"Line2", Dimension::Dim1, 2, 0, 0);
187 type->setInfos(
this, IT_Line3,
"Line3", Dimension::Dim1, 3, 0, 0);
197 type->setInfos(
this, IT_Line4,
"Line4", Dimension::Dim1, 4, 0, 0);
207 type->setInfos(
this, IT_CellLine2,
"CellLine2", Dimension::Dim1, 2, 0, 2);
225 type->setInfos(
this, IT_Triangle3,
"Triangle3", Dimension::Dim2, 3, 3, 3);
238 type->setInfos(
this, IT_Triangle6,
"Triangle6", Dimension::Dim2, 6, 3, 3);
256 type->setInfos(
this, IT_Triangle10,
"Triangle10", Dimension::Dim2, 10, 3, 3);
274 type->setInfos(
this, IT_Quad4,
"Quad4", Dimension::Dim2, 4, 4, 4);
287 type->setInfos(
this, IT_Quad8,
"Quad8", Dimension::Dim2, 8, 4, 4);
307 type->setInfos(
this, IT_Quad9,
"Quad9", Dimension::Dim2, 9, 4, 4);
327 type->setInfos(
this, IT_Pentagon5,
"Pentagon5", Dimension::Dim2, 5, 5, 5);
347 type->setInfos(
this, IT_Hexagon6,
"Hexagon6", Dimension::Dim2, 6, 6, 6);
369 type->setInfos(
this, IT_Hexaedron8,
"Hexaedron8", Dimension::Dim3, 8, 12, 6);
396 m_types[IT_Hexaedron20] = type;
398 type->setInfos(
this, IT_Hexaedron20,
"Hexaedron20", Dimension::Dim3, 20, 12, 6);
426 m_types[IT_Hexaedron27] = type;
428 type->setInfos(
this, IT_Hexaedron27,
"Hexaedron27", Dimension::Dim3, 27, 12, 6);
458 type->setInfos(
this, IT_Pyramid5,
"Pyramid5", Dimension::Dim3, 5, 8, 5);
481 type->setInfos(
this, IT_Pyramid13,
"Pyramid13", Dimension::Dim3, 13, 8, 5);
502 m_types[IT_Pentaedron6] = type;
504 type->setInfos(
this, IT_Pentaedron6,
"Pentaedron6", Dimension::Dim3, 6, 9, 5);
526 m_types[IT_Pentaedron15] = type;
527 type->
setOrder(2, ITI_Pentaedron15);
529 type->setInfos(
this, IT_Pentaedron15,
"Pentaedron15", Dimension::Dim3, 15, 9, 5);
551 m_types[IT_Tetraedron4] = type;
553 type->setInfos(
this, IT_Tetraedron4,
"Tetraedron4", Dimension::Dim3, 4, 6, 4);
572 m_types[IT_Tetraedron10] = type;
574 type->setInfos(
this, IT_Tetraedron10,
"Tetraedron10", Dimension::Dim3, 10, 6, 4);
593 m_types[IT_Heptaedron10] = type;
595 type->setInfos(
this, IT_Heptaedron10,
"Heptaedron10", Dimension::Dim3, 10, 15, 7);
625 m_types[IT_Octaedron12] = type;
627 type->setInfos(
this, IT_Octaedron12,
"Octaedron12", Dimension::Dim3, 12, 18, 8);
648 type->
addEdge(10, 10, 11, 1, 6);
649 type->
addEdge(11, 11, 6, 1, 7);
654 type->
addEdge(16, 4, 10, 5, 6);
655 type->
addEdge(17, 5, 11, 6, 7);
663 type->setInfos(
this, IT_HemiHexa7,
"HemiHexa7", Dimension::Dim3, 7, 11, 6);
690 type->setInfos(
this, IT_HemiHexa6,
"HemiHexa6", Dimension::Dim3, 6, 10, 6);
716 type->setInfos(
this, IT_HemiHexa5,
"HemiHexa5", Dimension::Dim3, 5, 7, 4);
735 m_types[IT_AntiWedgeLeft6] = type;
737 type->setInfos(
this, IT_AntiWedgeLeft6,
"AntiWedgeLeft6", Dimension::Dim3, 6, 10, 6);
761 m_types[IT_AntiWedgeRight6] = type;
763 type->setInfos(
this, IT_AntiWedgeRight6,
"AntiWedgeRight6", Dimension::Dim3, 6, 10, 6);
789 type->setInfos(
this, IT_DiTetra5,
"DiTetra5", Dimension::Dim3, 5, 9, 6);
814 type->setInfos(
this, IT_DualNode,
"DualNode", 1, 0, 0);
821 type->setInfos(
this, IT_DualEdge,
"DualEdge", 1, 0, 0);
828 type->setInfos(
this, IT_DualFace,
"DualFace", 1, 0, 0);
835 type->setInfos(
this, IT_DualCell,
"DualCell", 1, 0, 0);
840 m_types[IT_DualParticle] = type;
842 type->setInfos(
this, IT_DualParticle,
"DualParticle", 1, 0, 0);
849 type->setInfos(
this, IT_Link,
"Link", 0, 0, 0);
855 m_types[IT_Enneedron14] = type;
857 type->setInfos(
this, IT_Enneedron14,
"Enneedron14", Dimension::Dim3, 14, 21, 9);
879 type->
addEdge(10, 10, 11, 1, 5);
880 type->
addEdge(11, 11, 12, 1, 6);
881 type->
addEdge(12, 12, 13, 1, 7);
882 type->
addEdge(13, 13, 7, 1, 8);
886 type->
addEdge(17, 3, 10, 3, 4);
887 type->
addEdge(18, 4, 11, 4, 5);
888 type->
addEdge(19, 5, 12, 5, 6);
889 type->
addEdge(20, 6, 13, 6, 7);
894 m_types[IT_Decaedron16] = type;
896 type->setInfos(
this, IT_Decaedron16,
"Decaedron16", Dimension::Dim3, 16, 24, 10);
919 type->
addEdge(10, 10, 11, 1, 4);
920 type->
addEdge(11, 11, 12, 1, 5);
921 type->
addEdge(12, 12, 13, 1, 6);
922 type->
addEdge(13, 13, 14, 1, 7);
923 type->
addEdge(14, 14, 15, 1, 8);
924 type->
addEdge(15, 15, 8, 1, 9);
927 type->
addEdge(18, 2, 10, 3, 4);
928 type->
addEdge(19, 3, 11, 4, 5);
929 type->
addEdge(20, 4, 12, 5, 6);
930 type->
addEdge(21, 5, 13, 6, 7);
931 type->
addEdge(22, 6, 14, 7, 8);
932 type->
addEdge(23, 7, 15, 8, 9);
940 type->setInfos(
this, IT_Heptagon7,
"Heptagon7", Dimension::Dim2, 7, 7, 7);
956 type->setInfos(
this, IT_Octogon8,
"Octogon8", Dimension::Dim2, 8, 8, 8);
971 m_types[IT_Cell3D_Line2] = type;
973 type->setInfos(
this, IT_Cell3D_Line2,
"Cell3D_Line2", Dimension::Dim1, 2, 0, 0);
982 type->setInfos(
this, IT_CellLine3,
"CellLine3", Dimension::Dim1, 3, 0, 2);
991 m_types[IT_Cell3D_Line3] = type;
992 type->
setOrder(2, ITI_Cell3D_Line2);
994 type->setInfos(
this, IT_Cell3D_Line3,
"Cell3D_Line3", Dimension::Dim1, 3, 0, 0);
1000 m_types[IT_Cell3D_Triangle3] = type;
1003 if (is_non_manifold)
1004 std::swap(nb_face, nb_edge);
1006 type->setInfos(
this, IT_Cell3D_Triangle3,
"Cell3D_Triangle3", Dimension::Dim2, 3, nb_edge, nb_face);
1008 if (is_non_manifold) {
1023 m_types[IT_Cell3D_Triangle6] = type;
1026 if (is_non_manifold)
1027 std::swap(nb_face, nb_edge);
1029 type->setInfos(
this, IT_Cell3D_Triangle6,
"Cell3D_Triangle6", Dimension::Dim2, 6, nb_edge, nb_face);
1030 type->
setOrder(2, ITI_Cell3D_Triangle3);
1032 if (is_non_manifold) {
1047 m_types[IT_Cell3D_Quad4] = type;
1050 if (is_non_manifold)
1051 std::swap(nb_face, nb_edge);
1053 type->setInfos(
this, IT_Cell3D_Quad4,
"Cell3D_Quad4", Dimension::Dim2, 4, nb_edge, nb_face);
1054 if (is_non_manifold) {
1071 m_types[IT_Cell3D_Quad8] = type;
1075 if (is_non_manifold)
1076 std::swap(nb_face, nb_edge);
1078 type->setInfos(
this, IT_Cell3D_Quad8,
"Cell3D_Quad8", Dimension::Dim2, 8, nb_edge, nb_face);
1079 type->
setOrder(2, ITI_Cell3D_Quad4);
1081 if (is_non_manifold) {
1098 m_types[IT_Cell3D_Quad9] = type;
1102 if (is_non_manifold)
1103 std::swap(nb_face, nb_edge);
1105 type->setInfos(
this, IT_Cell3D_Quad9,
"Cell3D_Quad9", Dimension::Dim2, 9, nb_edge, nb_face);
1106 type->
setOrder(2, ITI_Cell3D_Quad4);
1108 if (is_non_manifold) {
1124 if (!arcane_item_type_file.
null()) {
1126 _readTypes(parallel_mng, arcane_item_type_file);
1133 ItemTypeInfoBuilder* type =
static_cast<ItemTypeInfoBuilder*
>(
m_types[i]);
1196 m_trace->info() <<
"Reading additional item types from file '" << filename <<
"'";
1204 if (file_length == 0)
1205 throw IOException(A_FUNCINFO,
"ARCANE_ITEM_TYPE_FILE is an empty file");
1206 std::ifstream ifile;
1207 ifile.open(filename.
localstr(), std::ios::binary);
1209 throw IOException(A_FUNCINFO,
"Cannot open ARCANE_ITEM_TYPE_FILE item type file");
1211 ifile.read((
char*)bytes.data(), file_length);
1212 bytes[(
Integer)file_length] =
'\0';
1214 throw IOException(A_FUNCINFO,
"Cannot read ARCANE_ITEM_TYPE_FILE item type file");
1215 size = bytes.size();
1231 typedef std::map<Integer, Integer> PolygonMapper;
1232 PolygonMapper built_polygons;
1233 built_polygons[3] = IT_Triangle3;
1234 built_polygons[4] = IT_Quad4;
1235 built_polygons[5] = IT_Pentagon5;
1236 built_polygons[6] = IT_Hexagon6;
1237 typedef std::set<Integer> KnownTypes;
1238 KnownTypes known_types;
1240 known_types.insert(i_type);
1246 std::istringstream ifile((
char*)bytes.unguardedBasePointer(), std::istringstream::in);
1251 Int16 typeId = -1, nbN = 0, nbE = 0, nbF = 0;
1252 for (
Integer i = 0; i < nb_type; ++i) {
1254 ifile >> typeId >> nbF >> nbE;
1255 if (typeId >= nb_type || typeId < 0)
1256 throw IOException(A_FUNCINFO, String::format(
"Polyhedron reader cannot allow typeId {0}", typeId));
1258 if (known_types.find(typeId) != known_types.end())
1259 throw FatalErrorException(A_FUNCINFO, String::format(
"Already existing typeId {0}", typeId));
1260 known_types.insert(typeId);
1266 nbN = nbE - nbF + 2;
1268 type->setInfos(
this, typeId, String::format(
"Polyhedron{0}_{1}-{2}-{3}", typeId, nbN, nbE, nbF), nbN, nbE, nbF);
1271 << nbE <<
" edges, " << nbF <<
" faces.";
1273 for (
Integer iface = 0; iface < nbF; ++iface) {
1276 for (
Integer inodeFace = 0; inodeFace < nbN; ++inodeFace) {
1277 ifile >> nodeFace[inodeFace];
1279 PolygonMapper::const_iterator finder = built_polygons.find(nbN);
1280 Int16 face_type = IT_NullType;
1281 if (finder != built_polygons.end()) {
1282 face_type = finder->second;
1284 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1291 built_polygons[nbN] = face_type;
1293 type2->setInfos(
this, face_type, String::format(
"Polygon{0}", nbN), nbN, nbN, nbN);
1294 for (
Integer j = 0; j < nbN; ++j)
1297 for (
Integer j = 0; j < nbN; ++j)
1298 type2->
addEdge(j, j, (j + 1) % nbN, (j - 1 + nbN) % nbN, (j + 1) % nbN);
1300 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1304 Integer node0, node1, leftFace, rightFace;
1305 for (
Integer iedge = 0; iedge < nbE; ++iedge) {
1306 ifile >> node0 >> node1 >> leftFace >> rightFace;
1307 type->
addEdge(iedge, node0, node1, leftFace, rightFace);