2 // File: SMDSControl.cxx
3 // Created: Wed Feb 20 18:33:06 2002
4 // Author: Jean-Michel BOULCOURT
5 // <jmb@localhost.localdomain>
8 #include "SMDSControl.ixx"
9 #include "SMDS_Mesh.hxx"
10 #include "SMDS_MeshElement.hxx"
11 #include "SMDS_ListOfMeshElement.hxx"
12 #include "SMDS_ListIteratorOfListOfMeshElement.hxx"
14 //=======================================================================
15 //function : ComputeNeighborFaces
17 //=======================================================================
19 Standard_Integer SMDSControl::ComputeNeighborFaces(const Handle(SMDS_Mesh)& M,
20 const Handle(SMDS_MeshElement)& ME,
21 const Standard_Integer idnode1,
22 const Standard_Integer idnode2)
24 const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
25 const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
26 const SMDS_ListOfMeshElement& lstInvFaces1 = node1->InverseElements();
27 const SMDS_ListOfMeshElement& lstInvFaces2 = node2->InverseElements();
28 Standard_Integer neighbor=0;
30 SMDS_ListIteratorOfListOfMeshElement it1(lstInvFaces1);
31 for (;it1.More();it1.Next()) {
32 const Handle(SMDS_MeshElement)& face = it1.Value();
33 if (M->Contains(face) && !face->IsSame(ME)) {
34 if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) {
44 SMDS_ListIteratorOfListOfMeshElement it2(lstInvFaces2);
45 for (;it2.More();it2.Next()) {
46 const Handle(SMDS_MeshElement)& face = it2.Value();
47 if (M->Contains(face) && !face->IsSame(ME)) {
48 if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) {
57 //=======================================================================
58 //function : ComputeNeighborVolumes
60 //=======================================================================
62 Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,
63 const Handle(SMDS_MeshElement)& ME,
64 const Standard_Integer idnode1,
65 const Standard_Integer idnode2,
66 const Standard_Integer idnode3)
69 const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
70 const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
71 const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3);
72 const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements();
73 const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements();
74 const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements();
76 Standard_Integer neighbor=0;
78 SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1);
79 for (;it1.More() && neighbor == 0;it1.Next()) {
80 const Handle(SMDS_MeshElement)& vol = it1.Value();
81 if (M->Contains(vol) && !vol->IsSame(ME)) {
82 if (vol->IsNodeInElement(idnode1)
83 && vol->IsNodeInElement(idnode2)
84 && vol->IsNodeInElement(idnode3)) {
94 SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2);
95 for (;it2.More() && neighbor == 0;it2.Next()) {
96 const Handle(SMDS_MeshElement)& vol = it2.Value();
97 if (M->Contains(vol) && !vol->IsSame(ME)) {
98 if (vol->IsNodeInElement(idnode1)
99 && vol->IsNodeInElement(idnode2)
100 && vol->IsNodeInElement(idnode3)) {
110 SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3);
111 for (;it3.More() && neighbor == 0;it3.Next()) {
112 const Handle(SMDS_MeshElement)& vol = it3.Value();
113 if (M->Contains(vol) && !vol->IsSame(ME)) {
114 if (vol->IsNodeInElement(idnode1)
115 && vol->IsNodeInElement(idnode2)
116 && vol->IsNodeInElement(idnode3)) {
126 //=======================================================================
127 //function : ComputeNeighborVolumes
129 //=======================================================================
131 Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,
132 const Handle(SMDS_MeshElement)& ME,
133 const Standard_Integer idnode1,
134 const Standard_Integer idnode2,
135 const Standard_Integer idnode3,
136 const Standard_Integer idnode4)
139 const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
140 const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
141 const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3);
142 const Handle(SMDS_MeshElement)& node4 = M->FindNode(idnode4);
143 const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements();
144 const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements();
145 const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements();
146 const SMDS_ListOfMeshElement& lstInvVol4 = node4->InverseElements();
147 Standard_Integer neighbor=0;
149 SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1);
150 for (;it1.More();it1.Next()) {
151 const Handle(SMDS_MeshElement)& vol = it1.Value();
152 if (M->Contains(vol) && !vol->IsSame(ME)) {
153 if ( vol->IsNodeInElement(idnode1)
154 && vol->IsNodeInElement(idnode2)
155 && vol->IsNodeInElement(idnode3)
156 && vol->IsNodeInElement(idnode4)) {
166 SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2);
167 for (;it2.More();it2.Next()) {
168 const Handle(SMDS_MeshElement)& vol = it2.Value();
169 if (M->Contains(vol) && !vol->IsSame(ME)) {
170 if ( vol->IsNodeInElement(idnode1)
171 && vol->IsNodeInElement(idnode2)
172 && vol->IsNodeInElement(idnode3)
173 && vol->IsNodeInElement(idnode4)) {
183 SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3);
184 for (;it3.More();it3.Next()) {
185 const Handle(SMDS_MeshElement)& vol = it3.Value();
186 if (M->Contains(vol) && !vol->IsSame(ME)) {
187 if ( vol->IsNodeInElement(idnode1)
188 && vol->IsNodeInElement(idnode2)
189 && vol->IsNodeInElement(idnode3)
190 && vol->IsNodeInElement(idnode4)) {
200 SMDS_ListIteratorOfListOfMeshElement it4(lstInvVol4);
201 for (;it4.More();it4.Next()) {
202 const Handle(SMDS_MeshElement)& vol = it4.Value();
203 if (M->Contains(vol) && !vol->IsSame(ME)) {
204 if ( vol->IsNodeInElement(idnode1)
205 && vol->IsNodeInElement(idnode2)
206 && vol->IsNodeInElement(idnode3)
207 && vol->IsNodeInElement(idnode4)) {