manualDecomp.C
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
00030 #include "manualDecomp.H"
00031 #include "addToRunTimeSelectionTable.H"
00032 #include "IFstream.H"
00033 #include "labelIOList.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039 defineTypeNameAndDebug(manualDecomp, 0);
00040
00041 addToRunTimeSelectionTable
00042 (
00043 decompositionMethod,
00044 manualDecomp,
00045 dictionary
00046 );
00047
00048 addToRunTimeSelectionTable
00049 (
00050 decompositionMethod,
00051 manualDecomp,
00052 dictionaryMesh
00053 );
00054 }
00055
00056
00057
00058
00059 Foam::manualDecomp::manualDecomp(const dictionary& decompositionDict)
00060 :
00061 decompositionMethod(decompositionDict)
00062 {
00063 notImplemented("manualDecomp(const dictionary&)");
00064 }
00065
00066
00067 Foam::manualDecomp::manualDecomp
00068 (
00069 const dictionary& decompositionDict,
00070 const polyMesh& mesh
00071 )
00072 :
00073 decompositionMethod(decompositionDict),
00074 meshPtr_(&mesh),
00075 decompDataFile_
00076 (
00077 decompositionDict.subDict(word(decompositionDict.lookup("method"))
00078 + "Coeffs").lookup("dataFile")
00079 )
00080 {}
00081
00082
00083
00084
00085 Foam::labelList Foam::manualDecomp::decompose(const pointField& points)
00086 {
00087 const polyMesh& mesh = *meshPtr_;
00088
00089 labelIOList finalDecomp
00090 (
00091 IOobject
00092 (
00093 decompDataFile_,
00094 mesh.facesInstance(),
00095 mesh,
00096 IOobject::MUST_READ,
00097 IOobject::AUTO_WRITE,
00098 false
00099 )
00100 );
00101
00102
00103
00104 if (finalDecomp.size() != points.size())
00105 {
00106 FatalErrorIn("manualDecomp::decompose(const pointField&)")
00107 << "Size of decomposition list does not correspond "
00108 << "to the number of points. Size: "
00109 << finalDecomp.size() << " Number of points: "
00110 << points.size()
00111 << ".\n" << "Manual decomposition data read from file "
00112 << decompDataFile_ << "." << endl
00113 << exit(FatalError);
00114 }
00115
00116 if (min(finalDecomp) < 0 || max(finalDecomp) > nProcessors_ - 1)
00117 {
00118 FatalErrorIn("labelList manualDecomp::decompose(const pointField&)")
00119 << "According to the decomposition, cells assigned to "
00120 << "impossible processor numbers. Min processor = "
00121 << min(finalDecomp) << " Max processor = " << max(finalDecomp)
00122 << ".\n" << "Manual decomposition data read from file "
00123 << decompDataFile_ << "." << endl
00124 << exit(FatalError);
00125 }
00126
00127 return finalDecomp;
00128 }
00129
00130
00131
Copyright © 2000-2009 OpenCFD Ltd