本文整理汇总了C++中PtrList::set方法的典型用法代码示例。如果您正苦于以下问题:C++ PtrList::set方法的具体用法?C++ PtrList::set怎么用?C++ PtrList::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PtrList
的用法示例。
在下文中一共展示了PtrList::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forAll
// In processor patches, there's a mix of internal faces (some
// of them turned) and possible cyclics. Slow loop
forAll (cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
label curF = cp[faceI] - 1;
// Is the face on the boundary?
if (curF >= mesh_.nInternalFaces())
{
label curBPatch =
mesh_.boundaryMesh().whichPatch(curF);
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvPatchField<Type>::New
(
mesh_.boundary()[curBPatch].type(),
mesh_.boundary()[curBPatch],
DimensionedField<Type, volMesh>::null()
)
);
}
// add the face
label curPatchFace =
mesh_.boundaryMesh()
[curBPatch].whichFace(curF);
patchFields[curBPatch][curPatchFace] =
curProcPatch[faceI];
}
}
开发者ID:GoldenMan123,项目名称:openfoam-extend-foam-extend-3.1,代码行数:37,代码来源:fvFieldReconstructorReconstructFields.C
示例2: forAll
void subsetPointFields
(
const fvMeshSubset& subsetter,
const pointMesh& pMesh,
const wordList& fieldNames,
PtrList<GeometricField<Type, pointPatchField, pointMesh> >& subFields
)
{
const fvMesh& baseMesh = subsetter.baseMesh();
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
Info<< "Subsetting field " << fieldName << endl;
GeometricField<Type, pointPatchField, pointMesh> fld
(
IOobject
(
fieldName,
baseMesh.time().timeName(),
baseMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
pMesh
);
subFields.set(i, subsetter.interpolate(fld));
}
}
示例3: forAll
bool addFieldsToList
(
const fvMesh& mesh,
PtrList<GeometricField<Type, fvPatchField, volMesh> >& list,
const wordList& fieldNames
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
label index = 0;
forAll(fieldNames, i)
{
IOobject obj
(
fieldNames[i],
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
);
if (obj.headerOk() && obj.headerClassName() == fieldType::typeName)
{
list.set(index++, new fieldType(obj, mesh));
}
else
{
Info<< "Could not find " << fieldNames[i] << endl;
return false;
}
}
示例4: forAll
forAll (procMeshes_, procI)
{
const GeometricField<Type, tetPolyPatchField, tetPointMesh>&
procField = procFields[procI];
// Get processor-to-global addressing for use in rmap
labelList procToGlobalAddr = procAddressing(procI);
// Set the cell values in the reconstructed field
internalField.rmap
(
procField.internalField(),
procToGlobalAddr
);
// Set the boundary patch values in the reconstructed field
forAll(boundaryProcAddressing_[procI], patchI)
{
// Get patch index of the original patch
const label curBPatch = boundaryProcAddressing_[procI][patchI];
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
tetPolyPatchField<Type>::New
(
procField.boundaryField()[patchI],
mesh_.boundary()[curBPatch],
DimensionedField<Type, tetPointMesh>::null(),
tetPolyPatchFieldReconstructor
(
mesh_.boundary()[curBPatch].size(),
procField.boundaryField()[patchI].size()
)
)
);
}
// If the field stores values, do the rmap
if (patchFields[curBPatch].storesFieldData())
{
patchFields[curBPatch].rmap
(
procField.boundaryField()[patchI],
procPatchAddressing
(
procToGlobalAddr,
procI,
patchI
)
);
}
}
}
}
开发者ID:GoldenMan123,项目名称:openfoam-extend-foam-extend-3.1,代码行数:60,代码来源:tetPointFieldReconstructorReconstructFields.C
示例5: objects
void readFields
(
PtrList<List<Type> >& values,
const List<word>& fieldNames,
const IOobjectList& cloudObjs
)
{
IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));
forAll(fieldNames, j)
{
const IOobject* obj = objects.lookup(fieldNames[j]);
if (obj != NULL)
{
Info<< " reading field " << fieldNames[j] << endl;
IOField<Type> newField(*obj);
values.set(j, new List<Type>(newField.xfer()));
}
else
{
FatalErrorIn
(
"template<class Type>"
"void readFields"
"("
"PtrList<List<Type> >&, "
"const List<word>&, "
"const IOobjectList&"
")"
)
<< "Unable to read field " << fieldNames[j]
<< abort(FatalError);
}
}
}
示例6: forAll
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
{
// Read the field for all the processors
PtrList<GeometricField<Type, pointPatchField, pointMesh>> procFields
(
procMeshes_.size()
);
forAll(procMeshes_, proci)
{
procFields.set
(
proci,
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
fieldIoObject.name(),
procMeshes_[proci]().time().timeName(),
procMeshes_[proci](),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
procMeshes_[proci]
)
);
}
示例7: forAllIter
void Foam::lagrangianFieldDecomposer::readFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList<PtrList<IOField<Type> > >& lagrangianFields
)
{
// Search list of objects for lagrangian fields
IOobjectList lagrangianTypeObjects
(
lagrangianObjects.lookupClass(IOField<Type>::typeName)
);
lagrangianFields.set
(
cloudI,
new PtrList<IOField<Type> >
(
lagrangianTypeObjects.size()
)
);
label lagrangianFieldi = 0;
forAllIter(IOobjectList, lagrangianTypeObjects, iter)
{
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new IOField<Type>(*iter())
);
}
示例8: fieldObjects
void readFields
(
const vtkMesh& vMesh,
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const HashSet<word>& selectedFields,
PtrList<GeoField>& fields
)
{
// Search list of objects for volScalarFields
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Construct the vol scalar fields
label nFields = fields.size();
fields.setSize(nFields + fieldObjects.size());
for
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{
if (selectedFields.empty() || selectedFields.found(iter()->name()))
{
fields.set
(
nFields,
vMesh.interpolate
(
GeoField
(
*iter(),
mesh
)
)
);
nFields++;
}
}
fields.setSize(nFields);
}
示例9: fieldType
void Foam::addToFieldList
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
const IOobject& obj,
const label fieldI,
const fvMesh& mesh
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (obj.headerClassName() == fieldType::typeName)
{
fieldList.set
(
fieldI,
new fieldType(obj, mesh)
);
Info<< " " << fieldType::typeName << tab << obj.name() << endl;
}
}
示例10: fieldObjects
void Foam::readFields
(
const Mesh& mesh,
const IOobjectList& objects,
PtrList<GeoField>& fields
)
{
// Search list of objects for volScalarFields
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Remove the cellDist field
IOobjectList::iterator celDistIter = fieldObjects.find("cellDist");
if (celDistIter != fieldObjects.end())
{
fieldObjects.erase(celDistIter);
}
// Construct the vol scalar fields
fields.setSize(fieldObjects.size());
label fieldi=0;
for
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{
fields.set
(
fieldi++,
new GeoField
(
*iter(),
mesh
)
);
}
}
示例11: if
Foam::searchableSurfaceControl::searchableSurfaceControl
(
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& geometryToConformTo,
const scalar& defaultCellSize
)
:
cellSizeAndAlignmentControl
(
runTime,
name,
controlFunctionDict,
geometryToConformTo,
defaultCellSize
),
surfaceName_(controlFunctionDict.lookupOrDefault<word>("surface", name)),
searchableSurface_(geometryToConformTo.geometry()[surfaceName_]),
geometryToConformTo_(geometryToConformTo),
cellSizeFunctions_(1),
regionToCellSizeFunctions_(searchableSurface_.regions().size(), -1),
maxPriority_(-1)
{
Info<< indent << "Master settings:" << endl;
Info<< incrIndent;
cellSizeFunctions_.set
(
0,
cellSizeFunction::New
(
controlFunctionDict,
searchableSurface_,
defaultCellSize_,
labelList()
)
);
Info<< decrIndent;
PtrList<cellSizeFunction> regionCellSizeFunctions;
DynamicList<label> defaultCellSizeRegions;
label nRegionCellSizeFunctions = 0;
// Loop over regions - if any entry is not specified they should
// inherit values from the parent surface.
if (controlFunctionDict.found("regions"))
{
const dictionary& regionsDict = controlFunctionDict.subDict("regions");
const wordList& regionNames = searchableSurface_.regions();
label nRegions = regionsDict.size();
regionCellSizeFunctions.setSize(nRegions);
defaultCellSizeRegions.setCapacity(nRegions);
forAll(regionNames, regionI)
{
const word& regionName = regionNames[regionI];
label regionID = geometryToConformTo_.geometry().findSurfaceRegionID
(
this->name(),
regionName
);
if (regionsDict.found(regionName))
{
// Get the dictionary for region
const dictionary& regionDict = regionsDict.subDict(regionName);
Info<< indent << "Region " << regionName
<< " (ID = " << regionID << ")" << " settings:"
<< endl;
Info<< incrIndent;
regionCellSizeFunctions.set
(
nRegionCellSizeFunctions,
cellSizeFunction::New
(
regionDict,
searchableSurface_,
defaultCellSize_,
labelList(1, regionID)
)
);
Info<< decrIndent;
regionToCellSizeFunctions_[regionID] = nRegionCellSizeFunctions;
nRegionCellSizeFunctions++;
}
else
{
// Add to default list
defaultCellSizeRegions.append(regionID);
//.........这里部分代码省略.........
示例12: tokenI
//.........这里部分代码省略.........
}
tokenI++;
}
const label closeFoundAt(tokenI);
// Ignore if the exponent is only 1 token
if ((closeFoundAt - commaFoundAt) > 2)
{
// Now create sub-equation
OStringStream subEqnStream;
for
(
label subTokenI(commaFoundAt + 1);
subTokenI < closeFoundAt;
subTokenI++
)
{
if
(
tl[subTokenI].isPunctuation()
&& (tl[subTokenI].pToken() == token::COLON))
{
subEqnStream << "^";
}
else
{
subEqnStream << tl[subTokenI];
}
}
string subEqnRawText(subEqnStream.str());
const equation& eqn(operator[](index));
equation subEqn
(
eqn.name() + "_powExponent_" + name(powFoundAt),
subEqnRawText,
eqn.overrideDimensions(),
eqn.changeDimensions()
);
bool eqnCreated(false);
for (label eqnI(0); eqnI < size(); eqnI++)
{
const equation& eqnTest(operator[](eqnI));
if (eqnTest.name() == subEqn.name())
{
clearEquation(eqnI);
eqnTest.setRawText(subEqn.rawText());
eqnTest.setOverrideDimensions
(
subEqn.overrideDimensions()
);
eqnTest.setChangeDimensions
(
eqnTest.changeDimensions()
);
eqnCreated = true;
}
}
if (!eqnCreated)
{
createEquation(subEqn);
}
// Change commaFoundAt + 1 entry to reflect new subEquation
// reference
tl[commaFoundAt + 1] = token(subEqn.name());
map.set
(
commaFoundAt + 1,
new equationOperation(findSource(subEqn.name()))
);
opLvl[commaFoundAt + 1] = 0;
pl[commaFoundAt + 1] = pl[commaFoundAt];
// Remove the subEquation from tl, map, opLvl and pl
label tokensRemoved(closeFoundAt - (commaFoundAt + 2));
label newSize(map.size() - tokensRemoved);
for
(
label subTokenI(commaFoundAt + 2);
subTokenI < newSize;
subTokenI++
)
{
tl[subTokenI] = tl[subTokenI + tokensRemoved];
map[subTokenI] = map[subTokenI + tokensRemoved];
opLvl[subTokenI] = opLvl[subTokenI + tokensRemoved];
pl[subTokenI] = pl[subTokenI + tokensRemoved];
}
tl.setSize(newSize);
map.setSize(newSize);
opLvl.setSize(newSize);
pl.setSize(newSize);
}
}
tokenI++;
}
}
示例13: reverseAddressing
forAll (procMeshes_, procI)
{
const GeometricField<Type, fvPatchField, volMesh>& procField =
procFields[procI];
// Set the cell values in the reconstructed field
internalField.rmap
(
procField.internalField(),
cellProcAddressing_[procI]
);
// Set the boundary patch values in the reconstructed field
forAll (boundaryProcAddressing_[procI], patchI)
{
// Get patch index of the original patch
const label curBPatch = boundaryProcAddressing_[procI][patchI];
// Get addressing slice for this patch
const labelList::subList cp =
procMeshes_[procI].boundary()[patchI].patchSlice
(
faceProcAddressing_[procI]
);
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvPatchField<Type>::New
(
procField.boundaryField()[patchI],
mesh_.boundary()[curBPatch],
DimensionedField<Type, volMesh>::null(),
fvPatchFieldReconstructor
(
mesh_.boundary()[curBPatch].size(),
procField.boundaryField()[patchI].size()
)
)
);
}
const label curPatchStart =
mesh_.boundaryMesh()[curBPatch].start();
labelList reverseAddressing(cp.size());
forAll (cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
patchFields[curBPatch].rmap
(
procField.boundaryField()[patchI],
reverseAddressing
);
}
else
{
示例14: dummyField
void Foam::GAMGSolver::Vcycle
(
const PtrList<lduMatrix::smoother>& smoothers,
scalargpuField& psi,
const scalargpuField& source,
scalargpuField& Apsi,
scalargpuField& finestCorrection,
scalargpuField& finestResidual,
scalargpuField& scratch1,
scalargpuField& scratch2,
PtrList<scalargpuField>& coarseCorrFields,
PtrList<scalargpuField>& coarseSources,
const direction cmpt
) const
{
//debug = 2;
const label coarsestLevel = matrixLevels_.size() - 1;
// Restrict finest grid residual for the next level up.
agglomeration_.restrictField(coarseSources[0], finestResidual, 0);
if (debug >= 2 && nPreSweeps_)
{
Pout<< "Pre-smoothing scaling factors: ";
}
// Residual restriction (going to coarser levels)
for (label leveli = 0; leveli < coarsestLevel; leveli++)
{
if (coarseSources.set(leveli + 1))
{
// If the optional pre-smoothing sweeps are selected
// smooth the coarse-grid field for the restriced source
if (nPreSweeps_)
{
coarseCorrFields[leveli] = 0.0;
smoothers[leveli + 1].smooth
(
coarseCorrFields[leveli],
coarseSources[leveli],
cmpt,
min
(
nPreSweeps_ + preSweepsLevelMultiplier_*leveli,
maxPreSweeps_
)
);
scalargpuField ACf
(
const_cast<const scalargpuField&>(scratch1),
coarseCorrFields[leveli].size()
);
// Scale coarse-grid correction field
// but not on the coarsest level because it evaluates to 1
if (scaleCorrection_ && leveli < coarsestLevel - 1)
{
scale
(
coarseCorrFields[leveli],
const_cast<scalargpuField&>(ACf),
matrixLevels_[leveli],
interfaceLevelsBouCoeffs_[leveli],
interfaceLevels_[leveli],
coarseSources[leveli],
cmpt
);
}
// Correct the residual with the new solution
matrixLevels_[leveli].Amul
(
ACf,
coarseCorrFields[leveli],
interfaceLevelsBouCoeffs_[leveli],
interfaceLevels_[leveli],
cmpt
);
coarseSources[leveli] -= ACf;
}
// Residual is equal to source
agglomeration_.restrictField
(
coarseSources[leveli + 1],
coarseSources[leveli],
leveli + 1
);
}
}
if (debug >= 2 && nPreSweeps_)
{
//.........这里部分代码省略.........
示例15: internalField
tmp<GeometricField<Type, pointPatchField, pointMesh> >
pointFieldDecomposer::decomposeField
(
const GeometricField<Type, pointPatchField, pointMesh>& field
) const
{
// Create and map the internal field values
Field<Type> internalField(field.internalField(), pointAddressing_);
// Create a list of pointers for the patchFields including one extra
// for the global patch
PtrList<pointPatchField<Type> > patchFields
(
boundaryAddressing_.size() + 1
);
// Create and map the patch field values
forAll (boundaryAddressing_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
patchFields.set
(
patchi,
pointPatchField<Type>::New
(
field.boundaryField()[boundaryAddressing_[patchi]],
procMesh_.boundary()[patchi],
DimensionedField<Type, pointMesh>::null(),
*patchFieldDecomposerPtrs_[patchi]
)
);
}
else
{
patchFields.set
(
patchi,
new ProcessorPointPatchField
<
pointPatchField,
pointMesh,
pointPatch,
processorPointPatch,
DummyMatrix,
Type
>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, pointMesh>::null()
)
);
}
}
// Add the global patch
patchFields.set
(
boundaryAddressing_.size(),
new GlobalPointPatchField
<
pointPatchField,
pointMesh,
pointPatch,
globalPointPatch,
DummyMatrix,
Type
>
(
procMesh_.boundary().globalPatch(),
DimensionedField<Type, pointMesh>::null()
)
);
// Create the field for the processor
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
(
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
field.name(),
procMesh_().time().timeName(),
procMesh_(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
procMesh_,
field.dimensions(),
internalField,
patchFields
)
);
}