STYLE: Code conformance tweaks

This commit is contained in:
andy
2011-06-14 13:23:45 +01:00
parent 2d2ecac7e5
commit cb684c42ba
2 changed files with 50 additions and 56 deletions

View File

@ -24,7 +24,7 @@ dict.add
dict.add("mergeDistance", SMALL); dict.add("mergeDistance", SMALL);
labelHashSet includePatches; labelHashSet includePatches;
forAll(patches, patchI) // forAll(patches, patchI)
{ {
if (!isA<processorPolyPatch>(patches[patchI])) if (!isA<processorPolyPatch>(patches[patchI]))
{ {

View File

@ -125,7 +125,6 @@ scalar calculateViewFactorFij
(cosThetaI*cosThetaJ*dAjMag*dAiMag) (cosThetaI*cosThetaJ*dAjMag*dAiMag)
/(sqr(rMag)*constant::mathematical::pi) /(sqr(rMag)*constant::mathematical::pi)
); );
} }
@ -152,7 +151,7 @@ void insertMatrixElements
} }
// Main program: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -180,8 +179,6 @@ int main(int argc, char *argv[])
const bool dumpRays = const bool dumpRays =
viewFactorDict.lookupOrDefault<bool>("dumpRays", false); viewFactorDict.lookupOrDefault<bool>("dumpRays", false);
// Debug
// ~~~~~
const label debug = viewFactorDict.lookupOrDefault<label>("debug", 0); const label debug = viewFactorDict.lookupOrDefault<label>("debug", 0);
volScalarField Qr volScalarField Qr
@ -211,8 +208,8 @@ int main(int argc, char *argv[])
) )
); );
// - Create the coarse mesh using agglomeration // // Create the coarse mesh using agglomeration
//-----------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (debug) if (debug)
{ {
@ -234,8 +231,8 @@ int main(int argc, char *argv[])
); );
// - Calculate total number of fine and coarse faces // // Calculate total number of fine and coarse faces
//---------------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label nCoarseFaces = 0; //total number of coarse faces label nCoarseFaces = 0; //total number of coarse faces
label nFineFaces = 0; //total number of fine faces label nFineFaces = 0; //total number of fine faces
@ -264,7 +261,7 @@ int main(int argc, char *argv[])
viewFactorsPatches.resize(count--); viewFactorsPatches.resize(count--);
//total number of coarse faces // total number of coarse faces
label totalNCoarseFaces = nCoarseFaces; label totalNCoarseFaces = nCoarseFaces;
reduce(totalNCoarseFaces, sumOp<label>()); reduce(totalNCoarseFaces, sumOp<label>());
@ -280,8 +277,8 @@ int main(int argc, char *argv[])
<< viewFactorsPatches << endl; << viewFactorsPatches << endl;
} }
// - Collect local Cf and Sf on coarse mesh //. // Collect local Cf and Sf on coarse mesh
//------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DynamicList<point> localCoarseCf(nCoarseFaces); DynamicList<point> localCoarseCf(nCoarseFaces);
DynamicList<point> localCoarseSf(nCoarseFaces); DynamicList<point> localCoarseSf(nCoarseFaces);
@ -348,8 +345,8 @@ int main(int argc, char *argv[])
} }
} }
// - Collect remote Cf and Sf on coarse mesh //. // Collect remote Cf and Sf on coarse mesh
//------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List<pointField> remoteCoarseCf(Pstream::nProcs()); List<pointField> remoteCoarseCf(Pstream::nProcs());
List<pointField> remoteCoarseSf(Pstream::nProcs()); List<pointField> remoteCoarseSf(Pstream::nProcs());
@ -357,8 +354,8 @@ int main(int argc, char *argv[])
remoteCoarseCf[Pstream::myProcNo()] = localCoarseCf; remoteCoarseCf[Pstream::myProcNo()] = localCoarseCf;
remoteCoarseSf[Pstream::myProcNo()] = localCoarseSf; remoteCoarseSf[Pstream::myProcNo()] = localCoarseSf;
// - Collect remote Cf and Sf on fine mesh //. // Collect remote Cf and Sf on fine mesh
//------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List<pointField> remoteFineCf(Pstream::nProcs()); List<pointField> remoteFineCf(Pstream::nProcs());
List<pointField> remoteFineSf(Pstream::nProcs()); List<pointField> remoteFineSf(Pstream::nProcs());
@ -367,7 +364,7 @@ int main(int argc, char *argv[])
remoteCoarseSf[Pstream::myProcNo()] = localCoarseSf; remoteCoarseSf[Pstream::myProcNo()] = localCoarseSf;
// Distribute local coarse Cf and Sf for shooting rays // Distribute local coarse Cf and Sf for shooting rays
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pstream::gatherList(remoteCoarseCf); Pstream::gatherList(remoteCoarseCf);
Pstream::scatterList(remoteCoarseCf); Pstream::scatterList(remoteCoarseCf);
@ -377,26 +374,22 @@ int main(int argc, char *argv[])
// Set up searching engine for obstacles // Set up searching engine for obstacles
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# include "searchingEngine.H" #include "searchingEngine.H"
// Determine rays between coarse face centres // Determine rays between coarse face centres
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DynamicList<label> rayStartFace DynamicList<label> rayStartFace(nCoarseFaces + 0.01*nCoarseFaces);
(
nCoarseFaces
+ 0.01*nCoarseFaces
);
DynamicList<label> rayEndFace(rayStartFace.size()); DynamicList<label> rayEndFace(rayStartFace.size());
globalIndex globalNumbering(nCoarseFaces); globalIndex globalNumbering(nCoarseFaces);
//- Return rayStartFace in local index andrayEndFace in global index // // Return rayStartFace in local index andrayEndFace in global index
// ------------------------------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# include "shootRays.H" #include "shootRays.H"
// Calculate number of visible faces from local index // Calculate number of visible faces from local index
labelList nVisibleFaceFaces(nCoarseFaces, 0); labelList nVisibleFaceFaces(nCoarseFaces, 0);
@ -476,7 +469,7 @@ int main(int argc, char *argv[])
// visibleFaceFaces has: // visibleFaceFaces has:
// (local face, local viewed face) = compact viewed face // (local face, local viewed face) = compact viewed face
//------------------------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nVisibleFaceFaces = 0; nVisibleFaceFaces = 0;
forAll(rayStartFace, i) forAll(rayStartFace, i)
@ -489,7 +482,7 @@ int main(int argc, char *argv[])
// Construct data in compact addressing // Construct data in compact addressing
// I need coarse Sf (Ai), fine Sf (dAi) and fine Cf(r) to calculate Fij // I need coarse Sf (Ai), fine Sf (dAi) and fine Cf(r) to calculate Fij
// --------------------------------------------------------------------// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pointField compactCoarseCf(map.constructSize(), pTraits<vector>::zero); pointField compactCoarseCf(map.constructSize(), pTraits<vector>::zero);
pointField compactCoarseSf(map.constructSize(), pTraits<vector>::zero); pointField compactCoarseSf(map.constructSize(), pTraits<vector>::zero);
@ -560,7 +553,7 @@ int main(int argc, char *argv[])
// Fill local view factor matrix // Fill local view factor matrix
//----------------------------- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scalarListIOList F scalarListIOList F
( (
@ -591,7 +584,7 @@ int main(int argc, char *argv[])
if (Pstream::master()) if (Pstream::master())
{ {
Info << "\nCalculating view factors..." << endl; Info<< "\nCalculating view factors..." << endl;
} }
if (mesh.nSolutionD() == 3) if (mesh.nSolutionD() == 3)
@ -606,7 +599,7 @@ int main(int argc, char *argv[])
const labelList& visCoarseFaces = visibleFaceFaces[coarseFaceI]; const labelList& visCoarseFaces = visibleFaceFaces[coarseFaceI];
forAll (visCoarseFaces, visCoarseFaceI) forAll(visCoarseFaces, visCoarseFaceI)
{ {
F[coarseFaceI].setSize(visCoarseFaces.size()); F[coarseFaceI].setSize(visCoarseFaces.size());
label compactJ = visCoarseFaces[visCoarseFaceI]; label compactJ = visCoarseFaces[visCoarseFaceI];
@ -647,7 +640,7 @@ int main(int argc, char *argv[])
const boundBox& box = mesh.bounds(); const boundBox& box = mesh.bounds();
const Vector<label>& dirs = mesh.geometricD(); const Vector<label>& dirs = mesh.geometricD();
vector emptyDir = vector::zero; vector emptyDir = vector::zero;
forAll (dirs, i) forAll(dirs, i)
{ {
if (dirs[i] == -1) if (dirs[i] == -1)
{ {
@ -657,7 +650,7 @@ int main(int argc, char *argv[])
scalar wideBy2 = (box.span() & emptyDir)*2.0; scalar wideBy2 = (box.span() & emptyDir)*2.0;
forAll (localCoarseSf, coarseFaceI) forAll(localCoarseSf, coarseFaceI)
{ {
const vector& Ai = localCoarseSf[coarseFaceI]; const vector& Ai = localCoarseSf[coarseFaceI];
const vector& Ci = localCoarseCf[coarseFaceI]; const vector& Ci = localCoarseCf[coarseFaceI];
@ -709,10 +702,10 @@ int main(int argc, char *argv[])
if (Pstream::master() && debug) if (Pstream::master() && debug)
{ {
forAll (viewFactorsPatches, i) forAll(viewFactorsPatches, i)
{ {
label patchI = viewFactorsPatches[i]; label patchI = viewFactorsPatches[i];
forAll (viewFactorsPatches, i) forAll(viewFactorsPatches, i)
{ {
label patchJ = viewFactorsPatches[i]; label patchJ = viewFactorsPatches[i];
Info << "F" << patchI << patchJ << ": " Info << "F" << patchI << patchJ << ": "
@ -749,7 +742,7 @@ int main(int argc, char *argv[])
const labelList& coarsePatchFace = const labelList& coarsePatchFace =
coarseMesh.patchFaceMap()[patchID]; coarseMesh.patchFaceMap()[patchID];
forAll (coarseToFine, coarseI) forAll(coarseToFine, coarseI)
{ {
const scalar Fij = sum(F[compactI]); const scalar Fij = sum(F[compactI]);
const label coarseFaceID = coarsePatchFace[coarseI]; const label coarseFaceID = coarsePatchFace[coarseI];
@ -858,4 +851,5 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
// ************************************************************************* // // ************************************************************************* //