lagrangianFieldDecomposer.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  Lagrangian field decomposer.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  const polyMesh& mesh,
36  const polyMesh& procMesh,
38  const labelList& cellProcAddressing,
39  const word& cloudName,
40  const Cloud<indexedParticle>& lagrangianPositions,
41  const List<SLList<indexedParticle*>*>& cellParticles
42 )
43 :
44  procMesh_(procMesh),
45  positions_(procMesh, cloudName, false),
46  particleIndices_(lagrangianPositions.size())
47 {
48  label pi = 0;
49 
50  // faceProcAddressing not required currently
51  // labelList decodedProcFaceAddressing(faceProcAddressing.size());
52 
53  // forAll(faceProcAddressing, i)
54  // {
55  // decodedProcFaceAddressing[i] = mag(faceProcAddressing[i]) - 1;
56  // }
57 
58  forAll(cellProcAddressing, procCelli)
59  {
60  label celli = cellProcAddressing[procCelli];
61 
62  if (cellParticles[celli])
63  {
64  SLList<indexedParticle*>& particlePtrs = *cellParticles[celli];
65 
66  forAllConstIter(SLList<indexedParticle*>, particlePtrs, iter)
67  {
68  const indexedParticle& ppi = *iter();
69  particleIndices_[pi++] = ppi.index();
70 
71  // label mappedTetFace = findIndex
72  // (
73  // decodedProcFaceAddressing,
74  // ppi.tetFace()
75  // );
76 
77  // if (mappedTetFace == -1)
78  // {
79  // FatalErrorInFunction
80  // << "Face lookup failure." << nl
81  // << abort(FatalError);
82  // }
83 
84  positions_.append
85  (
86  new passiveParticle
87  (
88  procMesh,
89  ppi.position(),
90  procCelli,
91  false
92  )
93  );
94  }
95  }
96  }
97 
98  particleIndices_.setSize(pi);
99 
101 }
102 
103 
104 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::SLList
Non-intrusive singly-linked list.
Definition: SLList.H:47
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::passiveParticle
Copy of base particle.
Definition: passiveParticle.H:50
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::indexedParticle
Adds label index to base particle.
Definition: indexedParticle.H:50
Foam::Cloud::size
label size() const
Definition: Cloud.H:175
Foam::IOPosition
Helper IO class to read and write particle positions.
Definition: Cloud.H:55
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::Cloud< indexedParticle >
Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
lagrangianFieldDecomposer(const lagrangianFieldDecomposer &)
Disallow default bitwise copy construct.
Foam::indexedParticle::index
label index() const
Definition: indexedParticle.H:117
cloudName
const word cloudName(propsDict.lookup("cloudName"))
Foam::particle::position
const vector & position() const
Return current particle position.
Definition: particleI.H:586
faceProcAddressing
PtrList< labelIOList > & faceProcAddressing
Definition: checkFaceAddressingComp.H:9
Foam::constant::mathematical::pi
const scalar pi(M_PI)
write
Tcoeff write()
lagrangianFieldDecomposer.H