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);
188 type->setInfos(
this, IT_Line3,
"Line3", Dimension::Dim1, 3, 0, 0);
197 type->setInfos(
this, IT_CellLine2,
"CellLine2", Dimension::Dim1, 2, 0, 2);
215 type->setInfos(
this, IT_Triangle3,
"Triangle3", Dimension::Dim2, 3, 3, 3);
228 type->setInfos(
this, IT_Triangle6,
"Triangle6", Dimension::Dim2, 6, 3, 3);
245 type->setInfos(
this, IT_Quad4,
"Quad4", Dimension::Dim2, 4, 4, 4);
258 type->setInfos(
this, IT_Quad8,
"Quad8", Dimension::Dim2, 8, 4, 4);
278 type->setInfos(
this, IT_Quad9,
"Quad9", Dimension::Dim2, 9, 4, 4);
298 type->setInfos(
this, IT_Pentagon5,
"Pentagon5", Dimension::Dim2, 5, 5, 5);
318 type->setInfos(
this, IT_Hexagon6,
"Hexagon6", Dimension::Dim2, 6, 6, 6);
340 type->setInfos(
this, IT_Hexaedron8,
"Hexaedron8", Dimension::Dim3, 8, 12, 6);
367 m_types[IT_Hexaedron20] = type;
369 type->setInfos(
this, IT_Hexaedron20,
"Hexaedron20", Dimension::Dim3, 20, 12, 6);
397 m_types[IT_Hexaedron27] = type;
399 type->setInfos(
this, IT_Hexaedron27,
"Hexaedron27", Dimension::Dim3, 27, 12, 6);
429 type->setInfos(
this, IT_Pyramid5,
"Pyramid5", Dimension::Dim3, 5, 8, 5);
452 type->setInfos(
this, IT_Pyramid13,
"Pyramid13", Dimension::Dim3, 13, 8, 5);
473 m_types[IT_Pentaedron6] = type;
475 type->setInfos(
this, IT_Pentaedron6,
"Pentaedron6", Dimension::Dim3, 6, 9, 5);
497 m_types[IT_Pentaedron15] = type;
498 type->
setOrder(2, ITI_Pentaedron15);
500 type->setInfos(
this, IT_Pentaedron15,
"Pentaedron15", Dimension::Dim3, 15, 9, 5);
522 m_types[IT_Tetraedron4] = type;
524 type->setInfos(
this, IT_Tetraedron4,
"Tetraedron4", Dimension::Dim3, 4, 6, 4);
543 m_types[IT_Tetraedron10] = type;
545 type->setInfos(
this, IT_Tetraedron10,
"Tetraedron10", Dimension::Dim3, 10, 6, 4);
564 m_types[IT_Heptaedron10] = type;
566 type->setInfos(
this, IT_Heptaedron10,
"Heptaedron10", Dimension::Dim3, 10, 15, 7);
596 m_types[IT_Octaedron12] = type;
598 type->setInfos(
this, IT_Octaedron12,
"Octaedron12", Dimension::Dim3, 12, 18, 8);
619 type->
addEdge(10, 10, 11, 1, 6);
620 type->
addEdge(11, 11, 6, 1, 7);
625 type->
addEdge(16, 4, 10, 5, 6);
626 type->
addEdge(17, 5, 11, 6, 7);
634 type->setInfos(
this, IT_HemiHexa7,
"HemiHexa7", Dimension::Dim3, 7, 11, 6);
661 type->setInfos(
this, IT_HemiHexa6,
"HemiHexa6", Dimension::Dim3, 6, 10, 6);
687 type->setInfos(
this, IT_HemiHexa5,
"HemiHexa5", Dimension::Dim3, 5, 7, 4);
706 m_types[IT_AntiWedgeLeft6] = type;
708 type->setInfos(
this, IT_AntiWedgeLeft6,
"AntiWedgeLeft6", Dimension::Dim3, 6, 10, 6);
732 m_types[IT_AntiWedgeRight6] = type;
734 type->setInfos(
this, IT_AntiWedgeRight6,
"AntiWedgeRight6", Dimension::Dim3, 6, 10, 6);
760 type->setInfos(
this, IT_DiTetra5,
"DiTetra5", Dimension::Dim3, 5, 9, 6);
785 type->setInfos(
this, IT_DualNode,
"DualNode", 1, 0, 0);
792 type->setInfos(
this, IT_DualEdge,
"DualEdge", 1, 0, 0);
799 type->setInfos(
this, IT_DualFace,
"DualFace", 1, 0, 0);
806 type->setInfos(
this, IT_DualCell,
"DualCell", 1, 0, 0);
811 m_types[IT_DualParticle] = type;
813 type->setInfos(
this, IT_DualParticle,
"DualParticle", 1, 0, 0);
820 type->setInfos(
this, IT_Link,
"Link", 0, 0, 0);
826 m_types[IT_Enneedron14] = type;
828 type->setInfos(
this, IT_Enneedron14,
"Enneedron14", Dimension::Dim3, 14, 21, 9);
850 type->
addEdge(10, 10, 11, 1, 5);
851 type->
addEdge(11, 11, 12, 1, 6);
852 type->
addEdge(12, 12, 13, 1, 7);
853 type->
addEdge(13, 13, 7, 1, 8);
857 type->
addEdge(17, 3, 10, 3, 4);
858 type->
addEdge(18, 4, 11, 4, 5);
859 type->
addEdge(19, 5, 12, 5, 6);
860 type->
addEdge(20, 6, 13, 6, 7);
865 m_types[IT_Decaedron16] = type;
867 type->setInfos(
this, IT_Decaedron16,
"Decaedron16", Dimension::Dim3, 16, 24, 10);
890 type->
addEdge(10, 10, 11, 1, 4);
891 type->
addEdge(11, 11, 12, 1, 5);
892 type->
addEdge(12, 12, 13, 1, 6);
893 type->
addEdge(13, 13, 14, 1, 7);
894 type->
addEdge(14, 14, 15, 1, 8);
895 type->
addEdge(15, 15, 8, 1, 9);
898 type->
addEdge(18, 2, 10, 3, 4);
899 type->
addEdge(19, 3, 11, 4, 5);
900 type->
addEdge(20, 4, 12, 5, 6);
901 type->
addEdge(21, 5, 13, 6, 7);
902 type->
addEdge(22, 6, 14, 7, 8);
903 type->
addEdge(23, 7, 15, 8, 9);
911 type->setInfos(
this, IT_Heptagon7,
"Heptagon7", Dimension::Dim2, 7, 7, 7);
927 type->setInfos(
this, IT_Octogon8,
"Octogon8", Dimension::Dim2, 8, 8, 8);
942 m_types[IT_Cell3D_Line2] = type;
944 type->setInfos(
this, IT_Cell3D_Line2,
"Cell3D_Line2", Dimension::Dim1, 2, 0, 0);
953 type->setInfos(
this, IT_CellLine3,
"CellLine3", Dimension::Dim1, 3, 0, 2);
962 m_types[IT_Cell3D_Line3] = type;
963 type->
setOrder(2, ITI_Cell3D_Line2);
965 type->setInfos(
this, IT_Cell3D_Line3,
"Cell3D_Line3", Dimension::Dim1, 3, 0, 0);
971 m_types[IT_Cell3D_Triangle3] = type;
975 std::swap(nb_face, nb_edge);
977 type->setInfos(
this, IT_Cell3D_Triangle3,
"Cell3D_Triangle3", Dimension::Dim2, 3, nb_edge, nb_face);
979 if (is_non_manifold) {
994 m_types[IT_Cell3D_Triangle6] = type;
998 std::swap(nb_face, nb_edge);
1000 type->setInfos(
this, IT_Cell3D_Triangle6,
"Cell3D_Triangle6", Dimension::Dim2, 6, nb_edge, nb_face);
1001 type->
setOrder(2, ITI_Cell3D_Triangle3);
1003 if (is_non_manifold) {
1018 m_types[IT_Cell3D_Quad4] = type;
1021 if (is_non_manifold)
1022 std::swap(nb_face, nb_edge);
1024 type->setInfos(
this, IT_Cell3D_Quad4,
"Cell3D_Quad4", Dimension::Dim2, 4, nb_edge, nb_face);
1025 if (is_non_manifold) {
1042 m_types[IT_Cell3D_Quad8] = type;
1046 if (is_non_manifold)
1047 std::swap(nb_face, nb_edge);
1049 type->setInfos(
this, IT_Cell3D_Quad8,
"Cell3D_Quad8", Dimension::Dim2, 8, nb_edge, nb_face);
1050 type->
setOrder(2, ITI_Cell3D_Quad4);
1052 if (is_non_manifold) {
1069 m_types[IT_Cell3D_Quad9] = type;
1073 if (is_non_manifold)
1074 std::swap(nb_face, nb_edge);
1076 type->setInfos(
this, IT_Cell3D_Quad9,
"Cell3D_Quad9", Dimension::Dim2, 9, nb_edge, nb_face);
1077 type->
setOrder(2, ITI_Cell3D_Quad4);
1079 if (is_non_manifold) {
1095 if (!arcane_item_type_file.
null()) {
1097 _readTypes(parallel_mng, arcane_item_type_file);
1104 ItemTypeInfoBuilder* type =
static_cast<ItemTypeInfoBuilder*
>(
m_types[i]);
1167 m_trace->info() <<
"Reading additional item types from file '" << filename <<
"'";
1175 if (file_length == 0)
1176 throw IOException(A_FUNCINFO,
"ARCANE_ITEM_TYPE_FILE is an empty file");
1177 std::ifstream ifile;
1178 ifile.open(filename.
localstr(), std::ios::binary);
1180 throw IOException(A_FUNCINFO,
"Cannot open ARCANE_ITEM_TYPE_FILE item type file");
1182 ifile.read((
char*)bytes.
data(), file_length);
1183 bytes[(
Integer)file_length] =
'\0';
1185 throw IOException(A_FUNCINFO,
"Cannot read ARCANE_ITEM_TYPE_FILE item type file");
1186 size = bytes.
size();
1202 typedef std::map<Integer, Integer> PolygonMapper;
1203 PolygonMapper built_polygons;
1204 built_polygons[3] = IT_Triangle3;
1205 built_polygons[4] = IT_Quad4;
1206 built_polygons[5] = IT_Pentagon5;
1207 built_polygons[6] = IT_Hexagon6;
1208 typedef std::set<Integer> KnownTypes;
1209 KnownTypes known_types;
1211 known_types.insert(i_type);
1222 Int16 typeId = -1, nbN = 0, nbE = 0, nbF = 0;
1223 for (
Integer i = 0; i < nb_type; ++i) {
1225 ifile >> typeId >> nbF >> nbE;
1226 if (typeId >= nb_type || typeId < 0)
1227 throw IOException(A_FUNCINFO, String::format(
"Polyhedron reader cannot allow typeId {0}", typeId));
1229 if (known_types.find(typeId) != known_types.end())
1230 throw FatalErrorException(A_FUNCINFO, String::format(
"Already existing typeId {0}", typeId));
1231 known_types.insert(typeId);
1237 nbN = nbE - nbF + 2;
1239 type->setInfos(
this, typeId, String::format(
"Polyhedron{0}_{1}-{2}-{3}", typeId, nbN, nbE, nbF), nbN, nbE, nbF);
1242 << nbE <<
" edges, " << nbF <<
" faces.";
1244 for (
Integer iface = 0; iface < nbF; ++iface) {
1247 for (
Integer inodeFace = 0; inodeFace < nbN; ++inodeFace) {
1248 ifile >> nodeFace[inodeFace];
1250 PolygonMapper::const_iterator finder = built_polygons.find(nbN);
1251 Int16 face_type = IT_NullType;
1252 if (finder != built_polygons.end()) {
1253 face_type = finder->second;
1255 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1262 built_polygons[nbN] = face_type;
1264 type2->setInfos(
this, face_type, String::format(
"Polygon{0}", nbN), nbN, nbN, nbN);
1265 for (
Integer j = 0; j < nbN; ++j)
1268 for (
Integer j = 0; j < nbN; ++j)
1269 type2->
addEdge(j, j, (j + 1) % nbN, (j - 1 + nbN) % nbN, (j + 1) % nbN);
1271 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1275 Integer node0, node1, leftFace, rightFace;
1276 for (
Integer iedge = 0; iedge < nbE; ++iedge) {
1277 ifile >> node0 >> node1 >> leftFace >> rightFace;
1278 type->
addEdge(iedge, node0, node1, leftFace, rightFace);