void Foam::twoStrokeEngine::calcMovingMasks() const
{
    if (debug)
    {
        Info<< "void movingSquaresTM::calcMovingMasks() const : "
            << "Calculating point and cell masks"
            << endl;
    }

    if (movingPointsMaskPtr_)
    {
        FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
                << "point mask already calculated"
                << abort(FatalError);
    }

    // Set the point mask
    movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
    scalarField& movingPointsMask = *movingPointsMaskPtr_;

    const cellList& c = cells();
    const faceList& f = allFaces();

    const label movingCellsID = cellZones().findZoneID("movingCells");

    // If moving cell zone is found, mark the vertices
    if (movingCellsID > -1)
    {
        const labelList& cellAddr = cellZones()[movingCellsID];

        forAll (cellAddr, cellI)
        {
            const cell& curCell = c[cellAddr[cellI]];

            forAll (curCell, faceI)
            {
                // Mark all the points as moving
                const face& curFace = f[curCell[faceI]];

                forAll (curFace, pointI)
                {
                    movingPointsMask[curFace[pointI]] = 1;
                }
            }
        }
    }
}
void Foam::pistonSliding::calcMovingMaskPistonValves(const label i) const
{
    if (debug)
    {
        Info<< "void movingSquaresTM::calcMovingMasks() const : "
            << "Calculating point and cell masks"
            << endl;
    }

    if (movingPointsMaskPistonValvesPtr_)
    {
        FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
            << "point mask already calculated"
            << abort(FatalError);
    }

    // Set the point mask
    movingPointsMaskPistonValvesPtr_ = new scalarField(allPoints().size(), 0);
    scalarField& movingPointsMaskPistonValves = *movingPointsMaskPistonValvesPtr_;

    const cellList& c = cells();
    const faceList& f = allFaces();

    const labelList& cellAddr =
        cellZones()[cellZones().findZoneID("movingCellsPistonV" + Foam::name(i+1))];

    forAll (cellAddr, cellI)
    {
        const cell& curCell = c[cellAddr[cellI]];

        forAll (curCell, faceI)
        {
            // Mark all the points as moving
            const face& curFace = f[curCell[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMaskPistonValves[curFace[pointI]] = 1;
            }
        }
    }
}
void Foam::pistonSliding::calcMovingMaskTop(const label i) const
{
    if (debug)
    {
        Info<< "void movingSquaresTM::calcMovingMasks() const : "
            << "Calculating point and cell masks"
            << endl;
    }

    if (movingPointsMaskTopPtr_)
    {
        FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
            << "point mask already calculated"
            << abort(FatalError);
    }

    // Set the point mask
    movingPointsMaskTopPtr_ = new scalarField(allPoints().size(), 0);
    scalarField& movingPointsMaskTop = *movingPointsMaskTopPtr_;

    const cellList& c = cells();
    const faceList& f = allFaces();

    const labelList& cellTopVAddr =
        cellZones()[cellZones().findZoneID("movingCellsTopZoneV"+ Foam::name(i+1))];

    forAll (cellTopVAddr, cellI)
    {
        const cell& curCell = c[cellTopVAddr[cellI]];

        forAll (curCell, faceI)
        {
            // Mark all the points as moving
            const face& curFace = f[curCell[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMaskTop[curFace[pointI]] = 1;
            }
        }
    }

    const labelList& cellTopAddr =
        cellZones()[cellZones().findZoneID("movingCellsZoneV"+ Foam::name(i+1))];

    forAll (cellTopAddr, cellI)
    {
        const cell& curCell = c[cellTopAddr[cellI]];

        forAll (curCell, faceI)
        {
            // Mark all the points as moving
            const face& curFace = f[curCell[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMaskTop[curFace[pointI]] = 1;
            }
        }
    }



/*
    if(valves_[i].poppetPatchID().active())
    {

        const word curtainCylZoneName
        (
            "curtainCylZoneV" + Foam::name(i + 1)
        );

        const labelList& curtainCylAddr =
            faceZones()[faceZones().findZoneID(curtainCylZoneName)];

        forAll (curtainCylAddr, faceI)
        {
            const face& curFace = f[curtainCylAddr[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMaskTop[curFace[pointI]] = 0;
            }
        }

    }
*/
}
Esempio n. 4
0
void Foam::simpleTwoStroke::calcMovingMasks() const
{
    if (debug)
    {
        Info<< "void movingSquaresTM::calcMovingMasks() const : "
            << "Calculating point and cell masks"
            << endl;
    }

    if (movingPointsMaskPtr_)
    {
        FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
            << "point mask already calculated"
            << abort(FatalError);
    }

    // Set the point mask
    movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
    scalarField& movingPointsMask = *movingPointsMaskPtr_;

    const cellList& c = cells();
    const faceList& f = allFaces();

    const labelList& cellAddr =
        cellZones()[cellZones().findZoneID("movingCells")];

    forAll (cellAddr, cellI)
    {
        const cell& curCell = c[cellAddr[cellI]];

        forAll (curCell, faceI)
        {
            // Mark all the points as moving
            const face& curFace = f[curCell[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMask[curFace[pointI]] = 1;
            }
        }
    }

    
    if(foundScavPorts())
    {

        const word innerScavZoneName
        (
            scavInCylPatchName_  + "Zone"
        );

        const labelList& innerScavAddr =
            faceZones()[faceZones().findZoneID(innerScavZoneName)];

        forAll (innerScavAddr, faceI)
        {
            const face& curFace = f[innerScavAddr[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMask[curFace[pointI]] = 1;
            }
        }

        const word outerScavZoneName
        (
            scavInPortPatchName_ + "Zone"
        );

        const labelList& outerScavAddr =
            faceZones()[faceZones().findZoneID(outerScavZoneName)];

        forAll (outerScavAddr, faceI)
        {
            const face& curFace = f[outerScavAddr[faceI]];

            forAll (curFace, pointI)
            {
                movingPointsMask[curFace[pointI]] = 0;
            }
        }
    
    }
           
}
Esempio n. 5
0
//--------------------------------------------------------------------------------------
void		componentConverter::vtxToConnectedFaceVtx(const	MIntArray&		vtxIDs, 
															MIntArray&		outVtxIDs)	
//--------------------------------------------------------------------------------------
{
	// Wandelt die vtxSelection in die connecteten faceVtx um (die Vertizen der verbundenen Faces)
	// Die gegebenen Vtx werden nicht mit hinzugefuegt

	outVtxIDs.setLength(0);
	outVtxIDs.setSizeIncrement(vtxIDs.length() / 4);

	MItMeshVertex	vertIter(mesh);
	MItMeshPolygon	polyIter(mesh);

	BPT_BA			allFaces(polyIter.count(), true);
	BPT_BA			allVtx(vertIter.count(), true);	// BA mit den vtxIDs initialisieren

	// Die vtxIds bereits jetzt false setzen
	allVtx.setBits(vtxIDs, false);


	MIntArray		conFaces;		// hlt die verbundenen Faces
	MIntArray		conVtx;			// Im face enthaltene Vtx
	
	uint i, x, y , l2,l3, l = vtxIDs.length();
	
	
	for(i = 0; i < l; i++)
	{
		vertIter .setIndex(vtxIDs[i], tmp);
		
		vertIter.getConnectedFaces(conFaces);
		
		// Jetzt die gueltigen conFaces holen
		conFaces = allFaces & conFaces;
		
		// Jetzt die conFaces false setzen, danit diese nicht wieder  bearbeitet werden
		allFaces.setBits(conFaces, false);
		
		
		l2 = conFaces.length();
		
		// jetzt die restlichen Faces on the fly in Vtx umwandeln
		for(x = 0; x < l2; x++)
		{
			
			// Jetzt die vertizen des Faces holen und auf Array packen, wenn sie einzigartig sind
			polyIter.setIndex(conFaces[x], tmp);
			
			polyIter.getVertices(conVtx);
			
			// Checken, ob Vtx einzigartig sind
			conVtx = allVtx & conVtx;

			// Das was uebrig bleibt im BitArray deaktivieren und zum outArray hinzufuegen 
			allVtx.setBits(conVtx, false);


			l3 = conVtx.length();
			for(y = 0; y < l3; y++)
			{
				outVtxIDs.append(conVtx[y]);
			}
		}
				
	}
	
}