Updates from Graham:
[OpenFOAM-1.5.x.git] / src / lagrangian / molecularDynamics / molecule / moleculeCloud / moleculeCloudBuildDirectInteractionList.H
blob5ee8135e994092876079ae5e69ffbe51537cccb8
1 Info << nl << "Building list of direct interaction neighbours" << endl;
3 forAll (mesh_.points(), p)
5     forAll(mesh_.faces(), f)
6     {
7         if(testPointFaceDistance(p, f))
8         {
9             const labelList& pCells(mesh_.pointCells()[p]);
11             const label cellO(mesh_.faceOwner()[f]);
13             forAll(pCells, pC)
14             {
15                 const label cellI(pCells[pC]);
17                 // cells are not added to their own DIL
19                 if (cellO > cellI)
20                 {
21                     if (findIndex(directInteractionList[cellI], cellO) == -1)
22                     {
23                         directInteractionList[cellI].append(cellO);
24                     }
25                 }
27                 if (cellI > cellO)
28                 {
29                     if (findIndex(directInteractionList[cellO], cellI) == -1)
30                     {
31                         directInteractionList[cellO].append(cellI);
32                     }
33                 }
35                 if (mesh_.isInternalFace(f))
36                 {
37                     // boundary faces will not have neighbour information
38                     const label cellN(mesh_.faceNeighbour()[f]);
40                     if (cellN > cellI)
41                     {
42                         if
43                         (
44                              findIndex(directInteractionList[cellI], cellN)
45                           == -1
46                         )
47                         {
48                             directInteractionList[cellI].append(cellN);
49                         }
50                     }
52                     if (cellI > cellN)
53                     {
54                         if
55                         (
56                             findIndex(directInteractionList[cellN], cellI)
57                          == -1
58                         )
59                         {
60                             directInteractionList[cellN].append(cellI);
61                         }
62                     }
63                 }
64             }
65         }
66     }
69 label edgeJIndex;
71 forAll (mesh_.edges(), edgeIIndex)
73     const edge& eI(mesh_.edges()[edgeIIndex]);
75     for
76     (
77         edgeJIndex = edgeIIndex + 1;
78         edgeJIndex != mesh_.edges().size();
79         ++edgeJIndex
80     )
81     {
82         const edge& eJ(mesh_.edges()[edgeJIndex]);
84         if (testEdgeEdgeDistance(eI, eJ))
85         {
86             const labelList& eICells(mesh_.edgeCells()[edgeIIndex]);
88             const labelList& eJCells(mesh_.edgeCells()[edgeJIndex]);
90             forAll(eICells, eIC)
91             {
92                 const label cellI(eICells[eIC]);
94                 forAll(eJCells, eJC)
95                 {
96                     const label cellJ(eJCells[eJC]);
98                     if (cellJ > cellI)
99                     {
100                         if
101                         (
102                             findIndex(directInteractionList[cellI], cellJ)
103                          == -1
104                         )
105                         {
106                             directInteractionList[cellI].append(cellJ);
107                         }
108                     }
110                     if (cellI > cellJ)
111                     {
112                         if
113                         (
114                             findIndex(directInteractionList[cellJ], cellI)
115                          == -1
116                         )
117                         {
118                             directInteractionList[cellJ].append(cellI);
119                         }
120                     }
121                 }
122             }
123         }
124     }
128 // label pointJIndex;
130 // forAll (mesh_.points(), pointIIndex)
131 // {
132 //     const point& ptI
133 //     (
134 //         mesh_.points()[pointIIndex]
135 //     );
137 //     for
138 //     (
139 //         pointJIndex = pointIIndex;
140 //         pointJIndex != mesh_.points().size();
141 //         ++pointJIndex
142 //     )
143 //     {
144 //         const point& ptJ
145 //         (
146 //             mesh_.points()[pointJIndex]
147 //         );
149 //         if (magSqr(ptI - ptJ) <= rCutMaxSqr)
150 //         {
151 //             const labelList& ptICells
152 //             (
153 //                 mesh_.pointCells()[pointIIndex]
154 //             );
156 //             const labelList& ptJCells
157 //             (
158 //                 mesh_.pointCells()[pointJIndex]
159 //             );
161 //             forAll(ptICells, pIC)
162 //             {
163 //                 const label cellI(ptICells[pIC]);
165 //                 forAll(ptJCells, pJC)
166 //                 {
167 //                     const label cellJ(ptJCells[pJC]);
169 //                     if (cellJ > cellI)
170 //                     {
171 //                         if(findIndex(directInteractionList[cellI], cellJ) == -1)
172 //                         {
173 //                             directInteractionList[cellI].append(cellJ);
174 //                         }
175 //                     }
177 //                     if (cellI > cellJ)
178 //                     {
179 //                         if(findIndex(directInteractionList[cellJ], cellI) == -1)
180 //                         {
181 //                             directInteractionList[cellJ].append(cellI);
182 //                         }
183 //                     }
184 //                 }
185 //             }
186 //         }
187 //     }
188 // }