Question2::
Needs["TetGenLink`"];
Needs["ComputationalGeometry`"];
long = 100;
broad = 100;
height = 100;
pts = {{0, 0, 0}, {long, 0, 0}, {long, broad, 0}, {0, broad, 0},
{0, 0, height}, {long, 0, height}, {long, broad, height}, {0,
broad, height}};
facets = {{{1, 2, 3, 4}}, {{5, 6, 7, 8}}, {{1, 5, 6, 2}}, {{2, 6, 7,
3}}, {{3, 7, 8, 4}}, {{4, 8, 5, 1}}};
inst = TetGenCreate[];
TetGenSetPoints[inst, pts];
TetGenSetFacets[inst, facets];
inst1 = TetGenTetrahedralize[inst, "pq1.414a4"];
ElemPtsCoord = TetGenGetPoints[inst1];
ElemFacesMadeofPtsIndex = TetGenGetFaces[inst1];
ElemElemsMadeofPtsIndex = TetGenGetElements[inst1];
Graphics3D[GraphicsComplex[ElemPtsCoord, Polygon[ElemFacesMadeofPtsIndex]]]
ElemPtsCoordandIndex = ElemPtsCoord;
Do[PrependTo[ElemPtsCoordandIndex[[i]], i], {i, 1,
Length[ElemPtsCoordandIndex]}
];
ElemElemsMadeofPtsIndexandIdex = ElemElemsMadeofPtsIndex;
Do[PrependTo[ElemElemsMadeofPtsIndexandIdex[[i]], i], {i, 1,
Length[ElemElemsMadeofPtsIndexandIdex]}
];
BoundaryPtsCoordandIndex = GatherBy[ElemPtsCoordandIndex,
(#1[[2]] == 0) || (#1[[2]] == 100) || (#1[[3]] == 0) || (#1[[3]] ==
100) || (#1[[4]] == 0) || (#1[[4]] == 100) &];
BoundaryPtsCoordandIndex = If[
BoundaryPtsCoordandIndex[[1, 1]][[2]] == 0 ||
BoundaryPtsCoordandIndex[[1, 1]][[2]] == 100 ||
BoundaryPtsCoordandIndex[[1, 1]][[3]] == 0 ||
BoundaryPtsCoordandIndex[[1, 1]][[3]] == 100 ||
BoundaryPtsCoordandIndex[[1, 1]][[4]] == 0 ||
BoundaryPtsCoordandIndex[[1, 1]][[4]] == 100,
BoundaryPtsCoordandIndex[[1]],
BoundaryPtsCoordandIndex[[2]]];
BoundaryPtsIndex =
Flatten[Take[BoundaryPtsCoordandIndex,
Length[BoundaryPtsCoordandIndex], 1]];
ClassifiedElements =
GatherBy[ElemElemsMadeofPtsIndexandIdex,
Intersection[BoundaryPtsIndex, Delete[#1, 1]] == {} &]
Introduction:
I have a cube sized 100*100*100. and I mesh it with fine mesh. So the total numbers of nodes and elements are huge.
and I have to find mesh tetrahedrons which are on the boundary.
First, Find points on the boundary faces-> "BoundaryPtsCoordandIndex".
Second, Find elements which has any point of "BoundaryPtsCoordandIndex".
This is my problem:
So the math problem is:
list1 = ElemElemsMadeofPtsIndexandIdex;
list2 = BoundaryPtsIndex;
and Find all sublists of list1 that contain any element of list2 ..?