本文整理汇总了C++中DynamicList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicList::append方法的具体用法?C++ DynamicList::append怎么用?C++ DynamicList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicList
的用法示例。
在下文中一共展示了DynamicList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allEdgeInfo
void Foam::regionToFace::markZone
(
const indirectPrimitivePatch& patch,
const label procI,
const label faceI,
const label zoneI,
labelList& faceZone
) const
{
// Data on all edges and faces
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
DynamicList<label> changedEdges;
DynamicList<patchEdgeFaceRegion> changedInfo;
if (Pstream::myProcNo() == procI)
{
const labelList& fEdges = patch.faceEdges()[faceI];
forAll(fEdges, i)
{
changedEdges.append(fEdges[i]);
changedInfo.append(zoneI);
}
}
示例2: expandedFile
void Foam::CSV<Type>::read()
{
fileName expandedFile(fName_);
IFstream is(expandedFile.expand());
if (!is.good())
{
FatalIOErrorIn("CSV<Type>::read()", is)
<< "Cannot open CSV file for reading."
<< exit(FatalIOError);
}
DynamicList<Tuple2<scalar, Type> > values;
// skip header
if (headerLine_)
{
string line;
is.getLine(line);
}
// read data
while (is.good())
{
string line;
is.getLine(line);
DynamicList<string> splitted;
std::size_t pos = 0;
while (pos != std::string::npos)
{
std::size_t nPos = line.find(separator_, pos);
if (nPos == std::string::npos)
{
splitted.append(line.substr(pos));
pos = nPos;
}
else
{
splitted.append(line.substr(pos, nPos - pos));
pos = nPos + 1;
}
}
if (splitted.size() <= 1)
{
break;
}
scalar x = readScalar(IStringStream(splitted[refColumn_])());
Type value = readValue(splitted);
values.append(Tuple2<scalar,Type>(x, value));
}
this->table_.transfer(values);
}
示例3: is
bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
(
const fileName& filename
)
{
const bool mustTriangulate = this->isTri();
this->clear();
IFstream is(filename);
if (!is.good())
{
FatalErrorIn
(
"fileFormats::OBJsurfaceFormat::read(const fileName&)"
)
<< "Cannot read file " << filename
<< exit(FatalError);
}
// assume that the groups are not intermixed
bool sorted = true;
DynamicList<point> dynPoints;
DynamicList<Face> dynFaces;
DynamicList<label> dynZones;
DynamicList<word> dynNames;
DynamicList<label> dynSizes;
HashTable<label> lookup;
// place faces without a group in zone0
label zoneI = 0;
lookup.insert("zone0", zoneI);
dynNames.append("zone0");
dynSizes.append(0);
while (is.good())
{
string line = this->getLineNoComment(is);
// handle continuations
if (line[line.size()-1] == '\\')
{
line.substr(0, line.size()-1);
line += this->getLineNoComment(is);
}
// Read first word
IStringStream lineStream(line);
word cmd;
lineStream >> cmd;
if (cmd == "v")
{
scalar x, y, z;
lineStream >> x >> y >> z;
dynPoints.append(point(x, y, z));
}
else if (cmd == "g")
示例4: regionMesh
void Foam::regionModels::regionModel1D::initialise()
{
if (debug)
{
Pout<< "regionModel1D::initialise()" << endl;
}
// Calculate boundaryFaceFaces and boundaryFaceCells
DynamicList<label> faceIDs;
DynamicList<label> cellIDs;
label localPyrolysisFaceI = 0;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchI];
forAll(ppCoupled, localFaceI)
{
label faceI = ppCoupled.start() + localFaceI;
label cellI = -1;
label nFaces = 0;
label nCells = 0;
do
{
label ownCellI = regionMesh().faceOwner()[faceI];
if (ownCellI != cellI)
{
cellI = ownCellI;
}
else
{
cellI = regionMesh().faceNeighbour()[faceI];
}
nCells++;
cellIDs.append(cellI);
const cell& cFaces = regionMesh().cells()[cellI];
faceI = cFaces.opposingFaceLabel(faceI, regionMesh().faces());
faceIDs.append(faceI);
nFaces++;
} while (regionMesh().isInternalFace(faceI));
boundaryFaceOppositeFace_[localPyrolysisFaceI] = faceI;
faceIDs.remove(); //remove boundary face.
nFaces--;
boundaryFaceFaces_[localPyrolysisFaceI].transfer(faceIDs);
boundaryFaceCells_[localPyrolysisFaceI].transfer(cellIDs);
localPyrolysisFaceI++;
nLayers_ = nCells;
}
}
示例5: inPtr
void Foam::csvTableReader<Type>::operator()
(
const fileName& fName,
List<Tuple2<scalar, Type>>& data
)
{
// IFstream in(fName);
autoPtr<ISstream> inPtr(fileHandler().NewIFstream(fName));
ISstream& in = inPtr();
DynamicList<Tuple2<scalar, Type>> values;
// Skip header
if (headerLine_)
{
string line;
in.getLine(line);
}
while (in.good())
{
string line;
in.getLine(line);
DynamicList<string> split;
std::size_t pos = 0;
while (pos != std::string::npos)
{
std::size_t nPos = line.find(separator_, pos);
if (nPos == std::string::npos)
{
split.append(line.substr(pos));
pos=nPos;
}
else
{
split.append(line.substr(pos, nPos-pos));
pos=nPos+1;
}
}
if (split.size() <= 1)
{
break;
}
scalar time = readScalar(IStringStream(split[timeColumn_])());
Type value = readValue(split);
values.append(Tuple2<scalar,Type>(time, value));
}
data.transfer(values);
}
示例6: findMolsToDel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void polyDelListOfAtoms::findMolsToDel()
{
label initialSize = molCloud_.size();
label deletedMols = 0;
Info << nl << "Deleting the following molecules... " << nl << endl;
DynamicList<vector> positions;
DynamicList<scalar> rMinCollect;
forAll(molPoints_, i)
{
DynamicList<polyMolecule*> molsToDel;
IDLList<polyMolecule>::iterator mol(molCloud_.begin());
scalar rMin = GREAT;
for
(
mol = molCloud_.begin();
mol != molCloud_.end();
++mol
)
{
if(findIndex(molIds_, mol().id()) != -1)
{
vector rT = molPoints_[i];
scalar magRIJ = mag(rT-mol().position());
if(magRIJ < rMin)
{
molsToDel.clear();
rMin = magRIJ;
polyMolecule* molI = &mol();
molsToDel.append(molI);
}
}
}
forAll(molsToDel, m)
{
positions.append(molsToDel[m]->position());
rMinCollect.append(rMin);
Info << molsToDel[m]->position()
<< endl;
deletedMols++;
deleteMolFromMoleculeCloud(*molsToDel[m]);
}
示例7: forAll
void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
(
boolList& mapFlag,
labelList& srcTgtSeed,
DynamicList<label>& srcSeeds,
DynamicList<label>& nonOverlapFaces,
label& srcFaceI,
label& tgtFaceI
) const
{
const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFaceI];
const labelList& tgtNbr = this->tgtPatch_.faceFaces()[tgtFaceI];
const pointField& srcPoints = this->srcPatch_.points();
const pointField& tgtPoints = this->tgtPatch_.points();
const vectorField& srcCf = this->srcPatch_.faceCentres();
forAll(srcNbr, i)
{
label srcI = srcNbr[i];
if (mapFlag[srcI] && srcTgtSeed[srcI] == -1)
{
const face& srcF = this->srcPatch_[srcI];
const vector srcN = srcF.normal(srcPoints);
bool found = false;
forAll(tgtNbr, j)
{
label tgtI = tgtNbr[j];
const face& tgtF = this->tgtPatch_[tgtI];
pointHit ray = tgtF.ray(srcCf[srcI], srcN, tgtPoints);
if (ray.hit())
{
// new match - append to lists
found = true;
srcTgtSeed[srcI] = tgtI;
srcSeeds.append(srcI);
break;
}
}
if (!found)
{
// no match available for source face srcI
mapFlag[srcI] = false;
nonOverlapFaces.append(srcI);
}
}
示例8: if
// Reads points section. Read region as well?
void readPoints
(
IFstream& is,
DynamicList<point>& points, // coordinates
DynamicList<label>& unvPointID // unv index
)
{
Sout<< "Starting reading points at line " << is.lineNumber() << '.' << endl;
static bool hasWarned = false;
while (true)
{
string line;
is.getLine(line);
label pointI = readLabel(IStringStream(line.substr(0, 10))());
if (pointI == -1)
{
break;
}
else if (pointI != points.size()+1 && !hasWarned)
{
hasWarned = true;
IOWarningIn
(
"readPoints(IFstream&, label&, DynamicList<point>"
", DynamicList<label>&)",
is
) << "Points not in order starting at point " << pointI
//<< " at line " << is.lineNumber()
//<< abort(FatalError);
<< endl;
}
point pt;
is.getLine(line);
pt[0] = readUnvScalar(line.substr(0, 25));
pt[1] = readUnvScalar(line.substr(25, 25));
pt[2] = readUnvScalar(line.substr(50, 25));
unvPointID.append(pointI);
points.append(pt);
}
points.shrink();
unvPointID.shrink();
Sout<< "Read " << points.size() << " points." << endl;
}
示例9: if
// Handle (non-processor) coupled faces.
void Foam::regionSplit::transferCoupledFaceRegion
(
const label faceI,
const label otherFaceI,
labelList& faceRegion,
DynamicList<label>& newChangedFaces
) const
{
if (faceRegion[faceI] >= 0)
{
if (faceRegion[otherFaceI] == -1)
{
faceRegion[otherFaceI] = faceRegion[faceI];
newChangedFaces.append(otherFaceI);
}
else if (faceRegion[otherFaceI] == -2)
{
// otherFaceI blocked but faceI is not. Is illegal for coupled
// faces, not for explicit connections.
}
else if (faceRegion[otherFaceI] != faceRegion[faceI])
{
FatalErrorIn
(
"regionSplit::transferCoupledFaceRegion"
"(const label, const label, labelList&, labelList&) const"
) << "Problem : coupled face " << faceI
<< " on patch " << mesh_.boundaryMesh().whichPatch(faceI)
<< " has region " << faceRegion[faceI]
<< " but coupled face " << otherFaceI
<< " has region " << faceRegion[otherFaceI]
<< endl
<< "Is your blocked faces specification"
<< " synchronized across coupled boundaries?"
<< abort(FatalError);
}
}
else if (faceRegion[faceI] == -1)
{
if (faceRegion[otherFaceI] >= 0)
{
faceRegion[faceI] = faceRegion[otherFaceI];
newChangedFaces.append(faceI);
}
else if (faceRegion[otherFaceI] == -2)
{
// otherFaceI blocked but faceI is not. Is illegal for coupled
// faces, not for explicit connections.
}
}
}
示例10: ptBlockStart
Foam::labelList Foam::backgroundMeshDecomposition::processorPosition
(
const List<PointType>& pts
) const
{
DynamicList<label> toCandidateProc;
DynamicList<point> testPoints;
labelList ptBlockStart(pts.size(), -1);
labelList ptBlockSize(pts.size(), -1);
label nTotalCandidates = 0;
forAll(pts, pI)
{
const pointFromPoint pt = topoint(pts[pI]);
label nCandidates = 0;
forAll(allBackgroundMeshBounds_, procI)
{
if (allBackgroundMeshBounds_[procI].contains(pt))
{
toCandidateProc.append(procI);
testPoints.append(pt);
nCandidates++;
}
}
ptBlockStart[pI] = nTotalCandidates;
ptBlockSize[pI] = nCandidates;
nTotalCandidates += nCandidates;
}
// Needed for reverseDistribute
label preDistributionToCandidateProcSize = toCandidateProc.size();
autoPtr<mapDistribute> map(buildMap(toCandidateProc));
map().distribute(testPoints);
List<bool> pointOnCandidate(testPoints.size(), false);
// Test candidate points on candidate processors
forAll(testPoints, tPI)
{
pointOnCandidate[tPI] = positionOnThisProcessor(testPoints[tPI]);
}
示例11: sampleParticle
void Foam::sampledSets::lineUniform::calcSamples
(
DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells,
DynamicList<label>& samplingFaces,
DynamicList<label>& samplingSegments,
DynamicList<scalar>& samplingCurveDist
) const
{
label sampleSegmentI = 0, sampleI = 0;
scalar sampleT = 0;
while (sampleI < nPoints_)
{
const point pt = (1 - sampleT)*start_ + sampleT*end_;
const label sampleCellI = searchEngine().findCell(pt);
if (sampleCellI == -1)
{
if (++ sampleI < nPoints_)
{
sampleT = scalar(sampleI)/(nPoints_ - 1);
}
}
else
{
passiveParticle sampleParticle(mesh(), pt, sampleCellI);
do
{
samplingPts.append(sampleParticle.position());
samplingCells.append(sampleParticle.cell());
samplingFaces.append(-1);
samplingSegments.append(sampleSegmentI);
samplingCurveDist.append(sampleT*mag(end_ - start_));
if (++ sampleI < nPoints_)
{
sampleT = scalar(sampleI)/(nPoints_ - 1);
sampleParticle.track((end_ - start_)/(nPoints_ - 1), 0);
}
}
while (sampleI < nPoints_ && !sampleParticle.onBoundaryFace());
++ sampleSegmentI;
}
}
}
示例12: if
void Foam::shortEdgeFilter2D::addRegion
(
const label regionI,
DynamicList<label>& bPointRegions
) const
{
if (bPointRegions.empty())
{
bPointRegions.append(regionI);
}
else if (findIndex(bPointRegions, regionI) == -1)
{
bPointRegions.append(regionI);
}
}
示例13: if
void Foam::functionEntries::ifeqEntry::skipUntil
(
DynamicList<filePos>& stack,
const dictionary& parentDict,
const word& endWord,
Istream& is
)
{
while (!is.eof())
{
token t;
readToken(t, is);
if (t.isWord())
{
if (t.wordToken() == "#if" || t.wordToken() == "#ifeq")
{
stack.append(filePos(is.name(), is.lineNumber()));
skipUntil(stack, parentDict, "#endif", is);
stack.remove();
}
else if (t.wordToken() == endWord)
{
return;
}
}
}
FatalIOErrorInFunction(parentDict)
<< "Did not find matching " << endWord << exit(FatalIOError);
}
示例14: splitValuesString
scalarList splitValuesString (
const string &values
) {
DynamicList<scalar> result;
std::string::size_type start=0;
std::string::size_type end=0;
while(start<values.length()) {
end=values.find(',',start);
if(end==std::string::npos) {
end=values.length();
}
result.append(
readScalar(
IStringStream(
values.substr(
start,end-start
)
)()
)
);
start=end+1;
}
result.shrink();
return result;
}
示例15:
void Foam::data::setSolverPerformance
(
const word& name,
const SolverPerformance<Type>& sp
) const
{
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
// Use a DynamicList to improve performance of the append
DynamicList<SolverPerformance<Type>> perfs;
const label timeIndex =
this->time().subCycling()
? this->time().prevTimeState().timeIndex()
: this->time().timeIndex();
if (prevTimeIndex_ != timeIndex)
{
// Reset solver performance between iterations
prevTimeIndex_ = timeIndex;
dict.clear();
}
else
{
dict.readIfPresent(name, perfs);
}
// Append to list
perfs.append(sp);
dict.set(name, perfs);
}