141 bool is_non_manifold =
false;
143 is_non_manifold =
mesh->meshKind().isNonManifold();
154 type->setInfos(
this, IT_NullType,
"NullType", Dimension::DimUnknown, 0, 0, 0);
162 type->setInfos(
this, IT_Vertex,
"Vertex", Dimension::Dim0, 0, 0, 0);
173 type->setInfos(
this, IT_FaceVertex,
"FaceVertex", Dimension::Dim0, 1, 0, 0);
182 type->setInfos(
this, IT_Line2,
"Line2", Dimension::Dim1, 2, 0, 0);
191 type->setInfos(
this, IT_Line3,
"Line3", Dimension::Dim1, 3, 0, 0);
201 type->setInfos(
this, IT_Line4,
"Line4", Dimension::Dim1, 4, 0, 0);
211 type->setInfos(
this, IT_CellLine2,
"CellLine2", Dimension::Dim1, 2, 0, 2);
229 type->setInfos(
this, IT_Triangle3,
"Triangle3", Dimension::Dim2, 3, 3, 3);
242 type->setInfos(
this, IT_Triangle6,
"Triangle6", Dimension::Dim2, 6, 3, 3);
260 type->setInfos(
this, IT_Triangle10,
"Triangle10", Dimension::Dim2, 10, 3, 3);
283 type->setInfos(
this, IT_Quad8,
"Quad8", Dimension::Dim2, 8, 4, 4);
303 type->setInfos(
this, IT_Quad9,
"Quad9", Dimension::Dim2, 9, 4, 4);
333 type->setInfos(
this, IT_Hexaedron8,
"Hexaedron8", Dimension::Dim3, 8, 12, 6);
360 m_types[IT_Hexaedron20] = type;
362 type->setInfos(
this, IT_Hexaedron20,
"Hexaedron20", Dimension::Dim3, 20, 12, 6);
390 m_types[IT_Hexaedron27] = type;
392 type->setInfos(
this, IT_Hexaedron27,
"Hexaedron27", Dimension::Dim3, 27, 12, 6);
422 type->setInfos(
this, IT_Pyramid5,
"Pyramid5", Dimension::Dim3, 5, 8, 5);
445 type->setInfos(
this, IT_Pyramid13,
"Pyramid13", Dimension::Dim3, 13, 8, 5);
466 m_types[IT_Pentaedron6] = type;
468 type->setInfos(
this, IT_Pentaedron6,
"Pentaedron6", Dimension::Dim3, 6, 9, 5);
490 m_types[IT_Pentaedron15] = type;
491 type->
setOrder(2, ITI_Pentaedron15);
493 type->setInfos(
this, IT_Pentaedron15,
"Pentaedron15", Dimension::Dim3, 15, 9, 5);
515 m_types[IT_Tetraedron4] = type;
517 type->setInfos(
this, IT_Tetraedron4,
"Tetraedron4", Dimension::Dim3, 4, 6, 4);
536 m_types[IT_Tetraedron10] = type;
538 type->setInfos(
this, IT_Tetraedron10,
"Tetraedron10", Dimension::Dim3, 10, 6, 4);
557 m_types[IT_Heptaedron10] = type;
559 type->setInfos(
this, IT_Heptaedron10,
"Heptaedron10", Dimension::Dim3, 10, 15, 7);
589 m_types[IT_Octaedron12] = type;
591 type->setInfos(
this, IT_Octaedron12,
"Octaedron12", Dimension::Dim3, 12, 18, 8);
612 type->
addEdge(10, 10, 11, 1, 6);
613 type->
addEdge(11, 11, 6, 1, 7);
618 type->
addEdge(16, 4, 10, 5, 6);
619 type->
addEdge(17, 5, 11, 6, 7);
627 type->setInfos(
this, IT_HemiHexa7,
"HemiHexa7", Dimension::Dim3, 7, 11, 6);
654 type->setInfos(
this, IT_HemiHexa6,
"HemiHexa6", Dimension::Dim3, 6, 10, 6);
680 type->setInfos(
this, IT_HemiHexa5,
"HemiHexa5", Dimension::Dim3, 5, 7, 4);
699 m_types[IT_AntiWedgeLeft6] = type;
701 type->setInfos(
this, IT_AntiWedgeLeft6,
"AntiWedgeLeft6", Dimension::Dim3, 6, 10, 6);
725 m_types[IT_AntiWedgeRight6] = type;
727 type->setInfos(
this, IT_AntiWedgeRight6,
"AntiWedgeRight6", Dimension::Dim3, 6, 10, 6);
753 type->setInfos(
this, IT_DiTetra5,
"DiTetra5", Dimension::Dim3, 5, 9, 6);
778 type->setInfos(
this, IT_DualNode,
"DualNode", 1, 0, 0);
785 type->setInfos(
this, IT_DualEdge,
"DualEdge", 1, 0, 0);
792 type->setInfos(
this, IT_DualFace,
"DualFace", 1, 0, 0);
799 type->setInfos(
this, IT_DualCell,
"DualCell", 1, 0, 0);
804 m_types[IT_DualParticle] = type;
806 type->setInfos(
this, IT_DualParticle,
"DualParticle", 1, 0, 0);
813 type->setInfos(
this, IT_Link,
"Link", 0, 0, 0);
819 m_types[IT_Enneedron14] = type;
821 type->setInfos(
this, IT_Enneedron14,
"Enneedron14", Dimension::Dim3, 14, 21, 9);
843 type->
addEdge(10, 10, 11, 1, 5);
844 type->
addEdge(11, 11, 12, 1, 6);
845 type->
addEdge(12, 12, 13, 1, 7);
846 type->
addEdge(13, 13, 7, 1, 8);
850 type->
addEdge(17, 3, 10, 3, 4);
851 type->
addEdge(18, 4, 11, 4, 5);
852 type->
addEdge(19, 5, 12, 5, 6);
853 type->
addEdge(20, 6, 13, 6, 7);
858 m_types[IT_Decaedron16] = type;
860 type->setInfos(
this, IT_Decaedron16,
"Decaedron16", Dimension::Dim3, 16, 24, 10);
883 type->
addEdge(10, 10, 11, 1, 4);
884 type->
addEdge(11, 11, 12, 1, 5);
885 type->
addEdge(12, 12, 13, 1, 6);
886 type->
addEdge(13, 13, 14, 1, 7);
887 type->
addEdge(14, 14, 15, 1, 8);
888 type->
addEdge(15, 15, 8, 1, 9);
891 type->
addEdge(18, 2, 10, 3, 4);
892 type->
addEdge(19, 3, 11, 4, 5);
893 type->
addEdge(20, 4, 12, 5, 6);
894 type->
addEdge(21, 5, 13, 6, 7);
895 type->
addEdge(22, 6, 14, 7, 8);
896 type->
addEdge(23, 7, 15, 8, 9);
912 m_types[IT_Cell3D_Line2] = type;
914 type->setInfos(
this, IT_Cell3D_Line2,
"Cell3D_Line2", Dimension::Dim1, 2, 0, 0);
923 type->setInfos(
this, IT_CellLine3,
"CellLine3", Dimension::Dim1, 3, 0, 2);
932 m_types[IT_Cell3D_Line3] = type;
933 type->
setOrder(2, ITI_Cell3D_Line2);
935 type->setInfos(
this, IT_Cell3D_Line3,
"Cell3D_Line3", Dimension::Dim1, 3, 0, 0);
941 m_types[IT_Cell3D_Triangle3] = type;
945 std::swap(nb_face, nb_edge);
947 type->setInfos(
this, IT_Cell3D_Triangle3,
"Cell3D_Triangle3", Dimension::Dim2, 3, nb_edge, nb_face);
949 if (is_non_manifold) {
964 m_types[IT_Cell3D_Triangle6] = type;
968 std::swap(nb_face, nb_edge);
970 type->setInfos(
this, IT_Cell3D_Triangle6,
"Cell3D_Triangle6", Dimension::Dim2, 6, nb_edge, nb_face);
971 type->
setOrder(2, ITI_Cell3D_Triangle3);
973 if (is_non_manifold) {
988 m_types[IT_Cell3D_Quad4] = type;
992 std::swap(nb_face, nb_edge);
994 type->setInfos(
this, IT_Cell3D_Quad4,
"Cell3D_Quad4", Dimension::Dim2, 4, nb_edge, nb_face);
995 if (is_non_manifold) {
1012 m_types[IT_Cell3D_Quad8] = type;
1016 if (is_non_manifold)
1017 std::swap(nb_face, nb_edge);
1019 type->setInfos(
this, IT_Cell3D_Quad8,
"Cell3D_Quad8", Dimension::Dim2, 8, nb_edge, nb_face);
1020 type->
setOrder(2, ITI_Cell3D_Quad4);
1022 if (is_non_manifold) {
1039 m_types[IT_Cell3D_Quad9] = type;
1043 if (is_non_manifold)
1044 std::swap(nb_face, nb_edge);
1046 type->setInfos(
this, IT_Cell3D_Quad9,
"Cell3D_Quad9", Dimension::Dim2, 9, nb_edge, nb_face);
1047 type->
setOrder(2, ITI_Cell3D_Quad4);
1049 if (is_non_manifold) {
1065 if (!arcane_item_type_file.
null()) {
1067 _readTypes(parallel_mng, arcane_item_type_file);
1074 ItemTypeInfoBuilder* type =
static_cast<ItemTypeInfoBuilder*
>(
m_types[i]);
1186 m_trace->info() <<
"Reading additional item types from file '" << filename <<
"'";
1194 if (file_length == 0)
1195 throw IOException(A_FUNCINFO,
"ARCANE_ITEM_TYPE_FILE is an empty file");
1196 std::ifstream ifile;
1197 ifile.open(filename.
localstr(), std::ios::binary);
1199 throw IOException(A_FUNCINFO,
"Cannot open ARCANE_ITEM_TYPE_FILE item type file");
1201 ifile.read((
char*)bytes.data(), file_length);
1202 bytes[(
Integer)file_length] =
'\0';
1204 throw IOException(A_FUNCINFO,
"Cannot read ARCANE_ITEM_TYPE_FILE item type file");
1205 size = bytes.size();
1221 typedef std::map<Integer, Integer> PolygonMapper;
1222 PolygonMapper built_polygons;
1223 built_polygons[3] = IT_Triangle3;
1224 built_polygons[4] = IT_Quad4;
1225 built_polygons[5] = IT_Pentagon5;
1226 built_polygons[6] = IT_Hexagon6;
1227 typedef std::set<Integer> KnownTypes;
1228 KnownTypes known_types;
1230 known_types.insert(i_type);
1233 ARCANE_FATAL(
"Invalid initialization of built-in item types");
1236 std::istringstream ifile((
char*)bytes.unguardedBasePointer(), std::istringstream::in);
1241 Int16 typeId = -1, nbN = 0, nbE = 0, nbF = 0;
1242 for (
Integer i = 0; i < nb_type; ++i) {
1244 ifile >> typeId >> nbF >> nbE;
1245 if (typeId >= nb_type || typeId < 0)
1248 if (known_types.find(typeId) != known_types.end())
1250 known_types.insert(typeId);
1256 nbN = nbE - nbF + 2;
1258 type->setInfos(
this, typeId, String::format(
"Polyhedron{0}_{1}-{2}-{3}", typeId, nbN, nbE, nbF), nbN, nbE, nbF);
1261 << nbE <<
" edges, " << nbF <<
" faces.";
1263 for (
Integer iface = 0; iface < nbF; ++iface) {
1266 for (
Integer inodeFace = 0; inodeFace < nbN; ++inodeFace) {
1267 ifile >> nodeFace[inodeFace];
1269 PolygonMapper::const_iterator finder = built_polygons.find(nbN);
1270 Int16 face_type = IT_NullType;
1271 if (finder != built_polygons.end()) {
1272 face_type = finder->second;
1274 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1281 built_polygons[nbN] = face_type;
1283 type2->setInfos(
this, face_type, String::format(
"Polygon{0}", nbN), nbN, nbN, nbN);
1284 for (
Integer j = 0; j < nbN; ++j)
1287 for (
Integer j = 0; j < nbN; ++j)
1288 type2->
addEdge(j, j, (j + 1) % nbN, (j - 1 + nbN) % nbN, (j + 1) % nbN);
1290 <<
" for face " << iface <<
" with " << nbN <<
" nodes";
1294 Integer node0, node1, leftFace, rightFace;
1295 for (
Integer iedge = 0; iedge < nbE; ++iedge) {
1296 ifile >> node0 >> node1 >> leftFace >> rightFace;
1297 type->
addEdge(iedge, node0, node1, leftFace, rightFace);