/usr/include/freefoam/OpenFOAM/mapPolyMesh.H is in libfreefoam-dev 0.1.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mapPolyMesh
Description
Class containing mesh-to-mesh mapping information after a change
in polyMesh topology.
General:
- pointMap/faceMap/cellMap: \n
from current mesh back to previous mesh.
(so to 'pull' the information onto the current mesh)
- reversePointMap/faceMap/cellMap: \n
from previous mesh to current. (so to 'push' information)
In the topology change points/faces/cells
- can be unchanged. (faces might be renumbered though)
- can be removed (into nothing)
- can be removed into/merged with existing same entity
(so point merged with other point, face with other face, cell with
other cell. Note that probably only cell with cell is relevant)
- can be added from existing same 'master' entity
(so point from point, face from face and cell from cell)
- can be inflated: face out of edge or point,
cell out of face, edge or point.
- can be appended: added 'out of nothing'.
All this information is nessecary to correctly map fields.
@par points
- unchanged:
- pointMap[pointI] contains old point label
- reversePointMap[oldPointI] contains new point label
- removed:
- reversePointMap[oldPointI] contains -1
- merged into point:
- reversePointMap[oldPointI] contains <-1 : -newPointI-2
- pointMap[pointI] contains the old master point label
- pointsFromPoints gives for pointI all the old point labels
(including the old master point!)
- added-from-same:
- pointMap[pointI] contains the old master point label
- appended:
- pointMap[pointI] contains -1
@par faces
- unchanged:
- faceMap[faceI] contains old face label
- reverseFaceMap[oldFaceI] contains new face label
- removed:
- reverseFaceMap[oldFaceI] contains -1
- merged into face:
- reverseFaceMap[oldFaceI] contains <-1 : -newFaceI-2
- faceMap[faceI] contains the old master face label
- facesFromFaces gives for faceI all the old face labels
(including the old master face!)
- added-from-same:
- faceMap[faceI] contains the old master face label
- inflated-from-edge:
- faceMap[faceI] contains -1
- facesFromEdges contains an entry with
- faceI
- list of faces(*) on old mesh that connected to the old edge
- inflated-from-point:
- faceMap[faceI] contains -1
- facesFromPoints contains an entry with
- faceI
- list of faces(*) on old mesh that connected to the old point
- appended:
- faceMap[faceI] contains -1
Note (*) \n
if the newly inflated face is a boundary face the list of faces will
only be boundary faces; if the new face is an internal face they
will only be internal faces.
@par cells
- unchanged:
- cellMap[cellI] contains old cell label
- reverseCellMap[oldCellI] contains new cell label
- removed:
- reverseCellMap[oldCellI] contains -1
- merged into cell:
- reverseCellMap[oldCellI] contains <-1 : -newCellI-2
- cellMap[cellI] contains the old master cell label
- cellsFromCells gives for cellI all the old cell labels
(including the old master cell!)
- added-from-same:
- cellMap[cellI] contains the old master cell label
- inflated-from-face:
- cellMap[cellI] contains -1
- cellsFromFaces contains an entry with
- cellI
- list of cells on old mesh that connected to the old face
- inflated-from-edge:
- cellMap[cellI] contains -1
- cellsFromEdges contains an entry with
- cellI
- list of cells on old mesh that connected to the old edge
- inflated-from-point:
- cellMap[cellI] contains -1
- cellsFromPoints contains an entry with
- cellI
- list of cells on old mesh that connected to the old point
- appended:
- cellMap[cellI] contains -1
SourceFiles
mapPolyMesh.C
\*---------------------------------------------------------------------------*/
#ifndef mapPolyMesh_H
#define mapPolyMesh_H
#include <OpenFOAM/labelList.H>
#include <OpenFOAM/objectMap.H>
#include <OpenFOAM/pointField.H>
#include <OpenFOAM/HashSet.H>
#include <OpenFOAM/Map.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mapPolyMesh Declaration
\*---------------------------------------------------------------------------*/
class mapPolyMesh
:
public refCount
{
// Private data
//- Reference to polyMesh
const polyMesh& mesh_;
//- Number of old live points
const label nOldPoints_;
//- Number of old live faces
const label nOldFaces_;
//- Number of old live cells
const label nOldCells_;
//- Old point map.
// Contains the old point label for all new points.
// - for preserved points this is the old point label.
// - for added points this is the master point ID
// - for points added with no master, this is -1
// Size of the list equals the size of new points
const labelList pointMap_;
//- Points resulting from merging points
const List<objectMap> pointsFromPointsMap_;
//- Old face map.
// Contains a list of old face labels for every new face.
// Size of the list equals the number of new faces
// - for preserved faces this is the old face label.
// - for faces added from faces this is the master face ID
// - for faces added with no master, this is -1
// - for faces added from points or edges, this is -1
const labelList faceMap_;
//- Faces inflated from points
const List<objectMap> facesFromPointsMap_;
//- Faces inflated from edges
const List<objectMap> facesFromEdgesMap_;
//- Faces resulting from merging faces
const List<objectMap> facesFromFacesMap_;
//- Old cell map.
// Contains old cell label for all preserved cells.
// Size of the list equals the number or preserved cells
const labelList cellMap_;
//- Cells inflated from points
const List<objectMap> cellsFromPointsMap_;
//- Cells inflated from edges
const List<objectMap> cellsFromEdgesMap_;
//- Cells inflated from faces
const List<objectMap> cellsFromFacesMap_;
//- Cells resulting from merging cells
const List<objectMap> cellsFromCellsMap_;
//- Reverse point map
const labelList reversePointMap_;
//- Reverse face map
const labelList reverseFaceMap_;
//- Reverse cell map
const labelList reverseCellMap_;
//- Map of flipped face flux faces
const labelHashSet flipFaceFlux_;
//- Patch mesh point renumbering
const labelListList patchPointMap_;
//- Point zone renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList pointZoneMap_;
//- Face zone point renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList faceZonePointMap_;
//- Face zone face renumbering
// For every preserved face in zone give the old position.
// For added faces, the index is set to -1
const labelListList faceZoneFaceMap_;
//- Cell zone renumbering
// For every preserved cell in zone give the old position.
// For added cells, the index is set to -1
const labelListList cellZoneMap_;
//- Pre-motion point positions.
// This specifies the correct way of blowing up zero-volume objects
const pointField preMotionPoints_;
//- List of the old patch sizes
labelList oldPatchSizes_;
//- List of the old patch start labels
const labelList oldPatchStarts_;
//- List of numbers of mesh points per old patch
const labelList oldPatchNMeshPoints_;
// Private Member Functions
//- Disallow default bitwise copy construct
mapPolyMesh(const mapPolyMesh&);
//- Disallow default bitwise assignment
void operator=(const mapPolyMesh&);
public:
// Constructors
//- Construct from components
mapPolyMesh
(
const polyMesh& mesh,
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
const labelList& pointMap,
const List<objectMap>& pointsFromPoints,
const labelList& faceMap,
const List<objectMap>& facesFromPoints,
const List<objectMap>& facesFromEdges,
const List<objectMap>& facesFromFaces,
const labelList& cellMap,
const List<objectMap>& cellsFromPoints,
const List<objectMap>& cellsFromEdges,
const List<objectMap>& cellsFromFaces,
const List<objectMap>& cellsFromCells,
const labelList& reversePointMap,
const labelList& reverseFaceMap,
const labelList& reverseCellMap,
const labelHashSet& flipFaceFlux,
const labelListList& patchPointMap,
const labelListList& pointZoneMap,
const labelListList& faceZonePointMap,
const labelListList& faceZoneFaceMap,
const labelListList& cellZoneMap,
const pointField& preMotionPoints,
const labelList& oldPatchStarts,
const labelList& oldPatchNMeshPoints
);
//- Construct from components and optionally reuse storage
mapPolyMesh
(
const polyMesh& mesh,
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList& pointMap,
List<objectMap>& pointsFromPoints,
labelList& faceMap,
List<objectMap>& facesFromPoints,
List<objectMap>& facesFromEdges,
List<objectMap>& facesFromFaces,
labelList& cellMap,
List<objectMap>& cellsFromPoints,
List<objectMap>& cellsFromEdges,
List<objectMap>& cellsFromFaces,
List<objectMap>& cellsFromCells,
labelList& reversePointMap,
labelList& reverseFaceMap,
labelList& reverseCellMap,
labelHashSet& flipFaceFlux,
labelListList& patchPointMap,
labelListList& pointZoneMap,
labelListList& faceZonePointMap,
labelListList& faceZoneFaceMap,
labelListList& cellZoneMap,
pointField& preMotionPoints,
labelList& oldPatchStarts,
labelList& oldPatchNMeshPoints,
const bool reUse
);
// Member Functions
// Access
//- Return polyMesh
const polyMesh& mesh() const
{
return mesh_;
}
//- Number of old points
label nOldPoints() const
{
return nOldPoints_;
}
//- Number of old internal faces
label nOldInternalFaces() const
{
return oldPatchStarts_[0];
}
//- Number of old faces
label nOldFaces() const
{
return nOldFaces_;
}
//- Number of old cells
label nOldCells() const
{
return nOldCells_;
}
//- Old point map.
// Contains the old point label for all new points.
// For preserved points this is the old point label.
// For added points this is the master point ID
const labelList& pointMap() const
{
return pointMap_;
}
//- Points originating from points
const List<objectMap>& pointsFromPointsMap() const
{
return pointsFromPointsMap_;
}
//- Old face map.
// Contains a list of old face labels for every new face.
// Warning: this map contains invalid entries for new faces
const labelList& faceMap() const
{
return faceMap_;
}
//- Faces inflated from points
const List<objectMap>& facesFromPointsMap() const
{
return facesFromPointsMap_;
}
//- Faces inflated from edges
const List<objectMap>& facesFromEdgesMap() const
{
return facesFromEdgesMap_;
}
//- Faces originating from faces
const List<objectMap>& facesFromFacesMap() const
{
return facesFromFacesMap_;
}
//- Old cell map.
// Contains old cell label for all preserved cells.
const labelList& cellMap() const
{
return cellMap_;
}
//- Cells inflated from points
const List<objectMap>& cellsFromPointsMap() const
{
return cellsFromPointsMap_;
}
//- Cells inflated from edges
const List<objectMap>& cellsFromEdgesMap() const
{
return cellsFromEdgesMap_;
}
//- Cells inflated from faces
const List<objectMap>& cellsFromFacesMap() const
{
return cellsFromFacesMap_;
}
//- Cells originating from cells
const List<objectMap>& cellsFromCellsMap() const
{
return cellsFromCellsMap_;
}
// Reverse maps
//- Reverse point map
// Contains new point label for all old and added points
const labelList& reversePointMap() const
{
return reversePointMap_;
}
//- If point is removed return point (on new mesh) it merged
// into
label mergedPoint(const label oldPointI) const
{
label i = reversePointMap_[oldPointI];
if (i == -1)
{
return i;
}
else if (i < -1)
{
return -i-2;
}
else
{
FatalErrorIn("mergedPoint(const label) const")
<< "old point label " << oldPointI
<< " has reverseMap " << i << endl
<< "Only call mergedPoint for removed points."
<< abort(FatalError);
return -1;
}
}
//- Reverse face map
// Contains new face label for all old and added faces
const labelList& reverseFaceMap() const
{
return reverseFaceMap_;
}
//- If face is removed return face (on new mesh) it merged into
label mergedFace(const label oldFaceI) const
{
label i = reverseFaceMap_[oldFaceI];
if (i == -1)
{
return i;
}
else if (i < -1)
{
return -i-2;
}
else
{
FatalErrorIn("mergedFace(const label) const")
<< "old face label " << oldFaceI
<< " has reverseMap " << i << endl
<< "Only call mergedFace for removed faces."
<< abort(FatalError);
return -1;
}
}
//- Reverse cell map
// Contains new cell label for all old and added cells
const labelList& reverseCellMap() const
{
return reverseCellMap_;
}
//- If cell is removed return cell (on new mesh) it merged into
label mergedCell(const label oldCellI) const
{
label i = reverseCellMap_[oldCellI];
if (i == -1)
{
return i;
}
else if (i < -1)
{
return -i-2;
}
else
{
FatalErrorIn("mergedCell(const label) const")
<< "old cell label " << oldCellI
<< " has reverseMap " << i << endl
<< "Only call mergedCell for removed cells."
<< abort(FatalError);
return -1;
}
}
//- Map of flipped face flux faces
const labelHashSet& flipFaceFlux() const
{
return flipFaceFlux_;
}
//- Patch point renumbering
// For every preserved point on a patch give the old position.
// For added points, the index is set to -1
const labelListList& patchPointMap() const
{
return patchPointMap_;
}
// Zone mapping
//- Point zone renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList& pointZoneMap() const
{
return pointZoneMap_;
}
//- Face zone point renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList& faceZonePointMap() const
{
return faceZonePointMap_;
}
//- Face zone face renumbering
// For every preserved face in zone give the old position.
// For added faces, the index is set to -1
const labelListList& faceZoneFaceMap() const
{
return faceZoneFaceMap_;
}
//- Cell zone renumbering
// For every preserved cell in zone give the old position.
// For added cells, the index is set to -1
const labelListList& cellZoneMap() const
{
return cellZoneMap_;
}
//- Pre-motion point positions.
// This specifies the correct way of blowing up
// zero-volume objects
const pointField& preMotionPoints() const
{
return preMotionPoints_;
}
//- Has valid preMotionPoints?
bool hasMotionPoints() const
{
return preMotionPoints_.size() > 0;
}
//- Return list of the old patch sizes
const labelList& oldPatchSizes() const
{
return oldPatchSizes_;
}
//- Return list of the old patch start labels
const labelList& oldPatchStarts() const
{
return oldPatchStarts_;
}
//- Return numbers of mesh points per old patch
const labelList& oldPatchNMeshPoints() const
{
return oldPatchNMeshPoints_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
|