OpenFOAM: API Guide
v2006
The open source CFD toolbox
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 | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2011-2017 OpenFOAM Foundation
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
Description
27
Lagrangian field decomposer.
28
29
\*---------------------------------------------------------------------------*/
30
31
#include "
lagrangianFieldDecomposer.H
"
32
33
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34
35
Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
36
(
37
const
polyMesh&
mesh
,
38
const
polyMesh& procMesh,
39
const
labelList
&
faceProcAddressing
,
40
const
labelList
& cellProcAddressing,
41
const
word&
cloudName
,
42
const
Cloud<indexedParticle>& lagrangianPositions,
43
const
List<SLList<indexedParticle*>*>& cellParticles
44
)
45
:
46
procMesh_(procMesh),
47
positions_(procMesh,
cloudName
,
IDLList
<passiveParticle>()),
48
particleIndices_(lagrangianPositions.size())
49
{
50
label
pi
= 0;
51
52
labelList
decodedProcFaceAddressing(
faceProcAddressing
.size());
53
54
forAll
(
faceProcAddressing
, i)
55
{
56
decodedProcFaceAddressing[i] =
mag
(
faceProcAddressing
[i]) - 1;
57
}
58
59
forAll
(cellProcAddressing, procCelli)
60
{
61
label celli = cellProcAddressing[procCelli];
62
63
if
(cellParticles[celli])
64
{
65
SLList<indexedParticle*>& particlePtrs = *cellParticles[celli];
66
67
forAllConstIters
(particlePtrs, iter)
68
{
69
const
indexedParticle& ppi = *iter();
70
particleIndices_[
pi
++] = ppi.index();
71
72
const
label mappedTetFace =
73
decodedProcFaceAddressing.find(ppi.tetFace());
74
75
if
(mappedTetFace == -1)
76
{
77
FatalErrorInFunction
78
<<
"Face lookup failure."
<<
nl
79
<<
abort
(
FatalError
);
80
}
81
82
positions_.append
83
(
84
new
passiveParticle
85
(
86
procMesh,
87
ppi.coordinates(),
88
procCelli,
89
mappedTetFace,
90
ppi.procTetPt(procMesh, procCelli, mappedTetFace)
91
)
92
);
93
}
94
}
95
}
96
97
particleIndices_.setSize(
pi
);
98
99
IOPosition<Cloud<passiveParticle>>(positions_).
write
();
100
}
101
102
103
// ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition:
List.H:71
faceProcAddressing
PtrList< labelIOList > & faceProcAddressing
Definition:
checkFaceAddressingComp.H:9
cloudName
const word cloudName(propsDict.get< word >("cloud"))
Foam::faMesh::write
virtual bool write(const bool valid=true) const
Write mesh.
Definition:
faMesh.C:1305
Foam::IDLList
ILList< DLListBase, T > IDLList
Definition:
IDLList.H:45
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition:
stdFoam.H:296
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition:
errorManip.H:137
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition:
error.H:372
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::nl
constexpr char nl
Definition:
Ostream.H:385
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition:
pEqn.H:28
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
lagrangianFieldDecomposer.H
applications
utilities
parallelProcessing
decomposePar
lagrangianFieldDecomposer.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.