GIT: conflict resolution

This commit is contained in:
andy
2012-09-26 12:13:44 +01:00
636 changed files with 20768 additions and 5580 deletions

View File

@ -29,6 +29,8 @@ License
#include "emptyPolyPatch.H"
#include "coupledPolyPatch.H"
#include "sampledSurface.H"
#include "mergePoints.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -222,6 +224,127 @@ void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict)
}
void Foam::fieldValues::faceSource::combineSurfaceGeometry
(
faceList& faces,
pointField& points
) const
{
List<faceList> allFaces(Pstream::nProcs());
List<pointField> allPoints(Pstream::nProcs());
labelList globalFacesIs(faceId_);
forAll(globalFacesIs, i)
{
if (facePatchId_[i] != -1)
{
label patchI = facePatchId_[i];
globalFacesIs[i] += mesh().boundaryMesh()[patchI].start();
}
}
// Add local faces and points to the all* lists
indirectPrimitivePatch pp
(
IndirectList<face>(mesh().faces(), globalFacesIs),
mesh().points()
);
allFaces[Pstream::myProcNo()] = pp.localFaces();
allPoints[Pstream::myProcNo()] = pp.localPoints();
Pstream::gatherList(allFaces);
Pstream::gatherList(allPoints);
// Renumber and flatten
label nFaces = 0;
label nPoints = 0;
forAll(allFaces, procI)
{
nFaces += allFaces[procI].size();
nPoints += allPoints[procI].size();
}
faces.setSize(nFaces);
points.setSize(nPoints);
nFaces = 0;
nPoints = 0;
// My own data first
{
const faceList& fcs = allFaces[Pstream::myProcNo()];
forAll(fcs, i)
{
const face& f = fcs[i];
face& newF = faces[nFaces++];
newF.setSize(f.size());
forAll(f, fp)
{
newF[fp] = f[fp] + nPoints;
}
}
const pointField& pts = allPoints[Pstream::myProcNo()];
forAll(pts, i)
{
points[nPoints++] = pts[i];
}
}
// Other proc data follows
forAll(allFaces, procI)
{
if (procI != Pstream::myProcNo())
{
const faceList& fcs = allFaces[procI];
forAll(fcs, i)
{
const face& f = fcs[i];
face& newF = faces[nFaces++];
newF.setSize(f.size());
forAll(f, fp)
{
newF[fp] = f[fp] + nPoints;
}
}
const pointField& pts = allPoints[procI];
forAll(pts, i)
{
points[nPoints++] = pts[i];
}
}
}
// Merge
labelList oldToNew;
pointField newPoints;
bool hasMerged = mergePoints
(
points,
SMALL,
false,
oldToNew,
newPoints
);
if (hasMerged)
{
if (debug)
{
Pout<< "Merged from " << points.size()
<< " down to " << newPoints.size() << " points" << endl;
}
points.transfer(newPoints);
forAll(faces, i)
{
inplaceRenumber(oldToNew, faces[i]);
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
@ -291,6 +414,14 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
}
Info<< nl << endl;
if (valueOutput_)
{
surfaceWriterPtr_.reset
(
surfaceWriter::New(dict.lookup("surfaceFormat")).ptr()
);
}
}
@ -355,6 +486,7 @@ Foam::fieldValues::faceSource::faceSource
)
:
fieldValue(name, obr, dict, loadFromFiles),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),

View File

@ -45,7 +45,8 @@ Description
functionObjectLibs ("libfieldFunctionObjects.so");
...
log yes;
valueOutput yes;
valueOutput true;
surfaceFormat none;
source faceZone;
sourceName f0;
operation sum;
@ -64,7 +65,8 @@ Description
Property | Description | Required | Default value
type | type name: faceSource | yes |
log | write data to standard output | no | no
valueOutput | write the raw output values | yes |
valueOutput | write the output values | yes |
surfaceFormat | output value format | no |
source | face source: see below | yes |
sourceName | name of face source if required | no |
operation | operation to perform | yes |
@ -132,6 +134,7 @@ SourceFiles
#include "fieldValue.H"
#include "surfaceFieldsFwd.H"
#include "volFieldsFwd.H"
#include "surfaceWriter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -201,11 +204,21 @@ private:
//- Set faces according to sampledSurface
void sampledSurfaceFaces(const dictionary&);
//- Combine faces and points from multiple processors
void combineSurfaceGeometry
(
faceList& faces,
pointField& points
) const;
protected:
// Protected data
//- Surface writer
autoPtr<surfaceWriter> surfaceWriterPtr_;
//- Source type
sourceType source_;
@ -219,7 +232,7 @@ protected:
label nFaces_;
// If operating on mesh faces (faceZone,patch)
// If operating on mesh faces (faceZone, patch)
//- Local list of face IDs
labelList faceId_;
@ -231,6 +244,7 @@ protected:
// (1 use as is, -1 negate)
labelList faceSign_;
// If operating on sampledSurface
//- underlying sampledSurface

View File

@ -254,31 +254,46 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
combineFields(Sf);
combineFields(weightField);
// Write raw values on surface if specified
if (surfaceWriterPtr_.valid())
{
faceList faces;
pointField points;
combineSurfaceGeometry(faces, points);
fileName outputDir;
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir = obr_.time().path()/".."/name_;
}
else
{
outputDir = obr_.time().path()/name_;
}
outputDir = outputDir/"surface"/obr_.time().timeName();
surfaceWriterPtr_->write
(
outputDir,
word(sourceTypeNames_[source_]) + "_" + sourceName_,
points,
faces,
fieldName,
values,
false
);
}
// apply weight field
values *= weightField;
if (Pstream::master())
{
Type result = processValues(values, Sf, weightField);
if (valueOutput_)
{
IOField<Type>
(
IOobject
(
fieldName + "_" + sourceTypeNames_[source_] + "-"
+ sourceName_,
obr_.time().timeName(),
obr_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
values
).write();
}
outputFilePtr_()<< tab << result;
if (log_)