118 GetOStream(
Runtime1) <<
"starting 'BuildCoarseGrid' routine...\n";
120 RCP<Teuchos::SerialDenseMatrix<GO,GO> > fineElementPDOFs = Get< RCP<Teuchos::SerialDenseMatrix<GO,GO> > >(fineLevel,
"PElementList");
122 GO totalFineElements = fineElementPDOFs->numRows();
125 GO totalCoarseElements = totalFineElements/4;
126 LO nCoarseElements = (int) sqrt(totalCoarseElements);
129 size_t EdgeCount = (nCoarseElements + 1) * (nCoarseElements + 1);
130 size_t CenterCount = EdgeCount + 2 * nCoarseElements * (nCoarseElements + 1);
134 RCP<Teuchos::SerialDenseMatrix<GO,GO> > coarseElementVDOFs = rcp(
new Teuchos::SerialDenseMatrix<GO,GO>(totalCoarseElements,18));
135 RCP<Teuchos::SerialDenseMatrix<GO,GO> > coarseElementPDOFs = rcp(
new Teuchos::SerialDenseMatrix<GO,GO>(totalCoarseElements,4));
136 RCP<Teuchos::SerialDenseMatrix<GO,GO> > coarseElementMDOFs = rcp(
new Teuchos::SerialDenseMatrix<GO,GO>(totalCoarseElements,9));
139 for ( GO coarseElement=0; coarseElement < totalCoarseElements; coarseElement++ )
150 if (coarseElement < nCoarseElements)
153 (*coarseElementMDOFs)(coarseElement,0) = coarseElement;
154 (*coarseElementMDOFs)(coarseElement,1) = coarseElement+1;
157 (*coarseElementMDOFs)(coarseElement,4) = EdgeCount++;
163 (*coarseElementMDOFs)(coarseElement,0) = (*coarseElementMDOFs)(coarseElement-nCoarseElements,3);
164 (*coarseElementMDOFs)(coarseElement,1) = (*coarseElementMDOFs)(coarseElement-nCoarseElements,2);
167 (*coarseElementMDOFs)(coarseElement,4) = (*coarseElementMDOFs)(coarseElement-nCoarseElements,6);
173 (*coarseElementMDOFs)(coarseElement,5) = EdgeCount++;
174 (*coarseElementMDOFs)(coarseElement,6) = EdgeCount++;
178 if (coarseElement % nCoarseElements == 0)
181 (*coarseElementMDOFs)(coarseElement,3) = (*coarseElementMDOFs)(coarseElement,0)+nCoarseElements+1;
184 (*coarseElementMDOFs)(coarseElement,7) = EdgeCount++;
190 (*coarseElementMDOFs)(coarseElement,3) = (*coarseElementMDOFs)(coarseElement-1,2);
193 (*coarseElementMDOFs)(coarseElement,7) = (*coarseElementMDOFs)(coarseElement-1,5);
197 (*coarseElementMDOFs)(coarseElement,2) = (*coarseElementMDOFs)(coarseElement,3)+1;
200 (*coarseElementMDOFs)(coarseElement,8) = CenterCount++;
206 (*coarseElementVDOFs)(coarseElement,0) = 2*(*coarseElementMDOFs)(coarseElement,0);
207 (*coarseElementVDOFs)(coarseElement,1) = 2*(*coarseElementMDOFs)(coarseElement,0)+1;
208 (*coarseElementVDOFs)(coarseElement,2) = 2*(*coarseElementMDOFs)(coarseElement,1);
209 (*coarseElementVDOFs)(coarseElement,3) = 2*(*coarseElementMDOFs)(coarseElement,1)+1;
210 (*coarseElementVDOFs)(coarseElement,4) = 2*(*coarseElementMDOFs)(coarseElement,2);
211 (*coarseElementVDOFs)(coarseElement,5) = 2*(*coarseElementMDOFs)(coarseElement,2)+1;
212 (*coarseElementVDOFs)(coarseElement,6) = 2*(*coarseElementMDOFs)(coarseElement,3);
213 (*coarseElementVDOFs)(coarseElement,7) = 2*(*coarseElementMDOFs)(coarseElement,3)+1;
214 (*coarseElementVDOFs)(coarseElement,8) = 2*(*coarseElementMDOFs)(coarseElement,4);
215 (*coarseElementVDOFs)(coarseElement,9) = 2*(*coarseElementMDOFs)(coarseElement,4)+1;
216 (*coarseElementVDOFs)(coarseElement,10) = 2*(*coarseElementMDOFs)(coarseElement,5);
217 (*coarseElementVDOFs)(coarseElement,11) = 2*(*coarseElementMDOFs)(coarseElement,5)+1;
218 (*coarseElementVDOFs)(coarseElement,12) = 2*(*coarseElementMDOFs)(coarseElement,6);
219 (*coarseElementVDOFs)(coarseElement,13) = 2*(*coarseElementMDOFs)(coarseElement,6)+1;
220 (*coarseElementVDOFs)(coarseElement,14) = 2*(*coarseElementMDOFs)(coarseElement,7);
221 (*coarseElementVDOFs)(coarseElement,15) = 2*(*coarseElementMDOFs)(coarseElement,7)+1;
222 (*coarseElementVDOFs)(coarseElement,16) = 2*(*coarseElementMDOFs)(coarseElement,8);
223 (*coarseElementVDOFs)(coarseElement,17) = 2*(*coarseElementMDOFs)(coarseElement,8)+1;
226 (*coarseElementPDOFs)(coarseElement,0) = (*coarseElementMDOFs)(coarseElement,0);
227 (*coarseElementPDOFs)(coarseElement,1) = (*coarseElementMDOFs)(coarseElement,1);
228 (*coarseElementPDOFs)(coarseElement,2) = (*coarseElementMDOFs)(coarseElement,2);
229 (*coarseElementPDOFs)(coarseElement,3) = (*coarseElementMDOFs)(coarseElement,3);
233 Set(coarseLevel,
"VElementList",coarseElementVDOFs);
234 Set(coarseLevel,
"PElementList",coarseElementPDOFs);
235 Set(coarseLevel,
"MElementList",coarseElementMDOFs);