226 std::cout <<
"writing packet 6..." << std::endl;
228 vtkSmartPointer<vtkIdList> facePtIds;
234 vtkSmartPointer<vtkStaticCellLocator> surfCellLocator =
surfMeshBase->buildStaticCellLocator();
236 vtkIdType nVerticesPerFaceMax = 0;
238 int nFacesPerCellMax = 0;
246 int numFaces = genCell1->GetNumberOfFaces();
247 nFacesPerCellMax = (nFacesPerCellMax < numFaces
250 auto surfPatchNoArr =
251 surfMeshBase->getDataSet()->GetCellData()->GetArray(
"patchNo");
252 if (!surfPatchNoArr) {
254 surfMeshBase->getDataSet()->GetCellData()->GetArray(
"PhysGrpId");
256 for (
int j = 0; j < numFaces; ++j)
258 vtkCell *faceObj = genCell1->GetFace(j);
260 vtkIdType numVerts = faceObj->GetNumberOfPoints();
261 nVerticesPerFaceMax = (nVerticesPerFaceMax < numVerts
263 : nVerticesPerFaceMax);
264 facePtIds = faceObj->GetPointIds();
266 volMeshBase->getDataSet()->GetCellNeighbors(i, facePtIds,
268 std::vector<nemId_t> facePntIds(numVerts);
269 for (vtkIdType k = 0; k < numVerts; ++k)
271 facePntIds[k] = faceObj->GetPointId(k) + 1;
273 if (sharedCellPtIds->GetNumberOfIds() == 0)
276 faceObj->GetBounds(bounds);
278 surfCellLocator->FindCellsWithinBounds(bounds, cellIds);
279 vtkIdType closestCellId;
280 if (cellIds->GetNumberOfIds() == 0) {
281 std::cerr <<
"No surface cell found." << std::endl;
284 closestCellId = cellIds->GetId(0);
285 if (cellIds->GetNumberOfIds() > 1) {
286 double p1[3], p2[3], p3[3];
287 faceObj->GetPoints()->GetPoint(0, p1);
288 faceObj->GetPoints()->GetPoint(1, p2);
289 faceObj->GetPoints()->GetPoint(2, p3);
290 std::vector<double> faceCenter(3);
291 for (vtkIdType k = 0; k < numVerts; ++k) {
292 faceCenter[k] = (p1[k] + p2[k] + p3[k]) / 3.0;
295 faceCenter -
surfMeshBase->getCellCenter(cellIds->GetId(0)));
296 for (vtkIdType k = 1; k < cellIds->GetNumberOfIds(); ++k) {
297 auto candidateCellCenter =
300 if (dist < minDist) {
302 closestCellId = cellIds->GetId(k);
307 double patchNo = surfPatchNoArr->GetComponent(closestCellId, 0);
310 for (vtkIdType iFaceNode = 0;
311 iFaceNode < facePtIds->GetNumberOfIds(); iFaceNode++)
314 static_cast<int>(patchNo));
319 outputStream << std::setw(2) << std::right <<
"6";
321 outputStream << std::setw(8) << std::right << i + 1;
323 outputStream << std::setw(8) << std::right <<
"1";
325 outputStream << std::setw(8) << std::right <<
"2";
327 for (
int i = 0; i < 5; i++)
329 outputStream << std::setw(8) << std::right <<
"0";
331 outputStream << std::endl;
335 outputStream << std::setw(3) << std::right
339 outputStream << std::setw(6) << std::right
343 outputStream << std::setw(8) << std::right <<
face2nodes[j];
346 outputStream << std::setw(2) << std::right
348 outputStream << std::endl;
353 snprintf(buffer, 17,
"%16.9E", (
double)
faceTypeMap[static_cast<int>(patchNo)]);
354 outputStream << buffer;
356 outputStream << std::endl;
std::shared_ptr< meshBase > surfMeshBase
std::map< int, std::string > face2nodes
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
std::map< int, int > faceTypeMap
std::map< nemId_t, std::vector< int > > boundaryNodeId2PatchNo
std::shared_ptr< meshBase > volMeshBase
T l2_Norm(const std::vector< T > &x)