Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "manualDecomp.H"
00030 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00031 #include <OpenFOAM/IFstream.H>
00032 #include <OpenFOAM/labelIOList.H>
00033
00034
00035
00036 namespace Foam
00037 {
00038 defineTypeNameAndDebug(manualDecomp, 0);
00039
00040 addToRunTimeSelectionTable
00041 (
00042 decompositionMethod,
00043 manualDecomp,
00044 dictionary
00045 );
00046
00047 addToRunTimeSelectionTable
00048 (
00049 decompositionMethod,
00050 manualDecomp,
00051 dictionaryMesh
00052 );
00053 }
00054
00055
00056
00057
00058 Foam::manualDecomp::manualDecomp(const dictionary& decompositionDict)
00059 :
00060 decompositionMethod(decompositionDict)
00061 {
00062 notImplemented("manualDecomp(const dictionary&)");
00063 }
00064
00065
00066 Foam::manualDecomp::manualDecomp
00067 (
00068 const dictionary& decompositionDict,
00069 const polyMesh& mesh
00070 )
00071 :
00072 decompositionMethod(decompositionDict),
00073 meshPtr_(&mesh),
00074 decompDataFile_
00075 (
00076 decompositionDict.subDict(word(decompositionDict.lookup("method"))
00077 + "Coeffs").lookup("dataFile")
00078 )
00079 {}
00080
00081
00082
00083
00084 Foam::labelList Foam::manualDecomp::decompose
00085 (
00086 const pointField& points,
00087 const scalarField& pointWeights
00088 )
00089 {
00090 const polyMesh& mesh = *meshPtr_;
00091
00092 labelIOList finalDecomp
00093 (
00094 IOobject
00095 (
00096 decompDataFile_,
00097 mesh.facesInstance(),
00098 mesh,
00099 IOobject::MUST_READ,
00100 IOobject::AUTO_WRITE,
00101 false
00102 )
00103 );
00104
00105
00106
00107 if (finalDecomp.size() != points.size())
00108 {
00109 FatalErrorIn
00110 (
00111 "manualDecomp::decompose(const pointField&, const scalarField&)"
00112 ) << "Size of decomposition list does not correspond "
00113 << "to the number of points. Size: "
00114 << finalDecomp.size() << " Number of points: "
00115 << points.size()
00116 << ".\n" << "Manual decomposition data read from file "
00117 << decompDataFile_ << "." << endl
00118 << exit(FatalError);
00119 }
00120
00121 if (min(finalDecomp) < 0 || max(finalDecomp) > nProcessors_ - 1)
00122 {
00123 FatalErrorIn
00124 (
00125 "manualDecomp::decompose(const pointField&, const scalarField&)"
00126 ) << "According to the decomposition, cells assigned to "
00127 << "impossible processor numbers. Min processor = "
00128 << min(finalDecomp) << " Max processor = " << max(finalDecomp)
00129 << ".\n" << "Manual decomposition data read from file "
00130 << decompDataFile_ << "." << endl
00131 << exit(FatalError);
00132 }
00133
00134 return finalDecomp;
00135 }
00136
00137
00138