Exemplo n.º 1
0
Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
{
    if (debug)
    {
        Info<< "polyMesh::readUpdateState fvMesh::readUpdate() : "
            << "Updating fvMesh.  ";
    }

    // Note: issues with update: should meshObject update happen
    // in polyMesh or fvMesh?  HJ, 18/Feb/2011
    polyMesh::readUpdateState state = polyMesh::readUpdate();

    if (state == polyMesh::TOPO_PATCH_CHANGE)
    {
        if (debug)
        {
            Info << "Boundary and topological update" << endl;
        }

        boundary_.readUpdate(boundaryMesh());

        clearOut();

    }
    else if (state == polyMesh::TOPO_CHANGE)
    {
        if (debug)
        {
            Info << "Topological update" << endl;
        }

        clearOut();
    }
    else if (state == polyMesh::POINTS_MOVED)
    {
        if (debug)
        {
            Info << "Point motion update" << endl;
        }

        clearGeom();
    }
    else
    {
        if (debug)
        {
            Info << "No update" << endl;
        }
    }

    return state;
}
Exemplo n.º 2
0
Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
{
    if (debug)
    {
        Info<< "polyMesh::readUpdateState fvMesh::readUpdate() : "
            << "Updating fvMesh.  ";
    }

    polyMesh::readUpdateState state = polyMesh::readUpdate();

    if (state == polyMesh::TOPO_PATCH_CHANGE)
    {
        if (debug)
        {
            Info<< "Boundary and topological update" << endl;
        }

        boundary_.readUpdate(boundaryMesh());

        clearOut();

    }
    else if (state == polyMesh::TOPO_CHANGE)
    {
        if (debug)
        {
            Info<< "Topological update" << endl;
        }

        clearOut();
    }
    else if (state == polyMesh::POINTS_MOVED)
    {
        if (debug)
        {
            Info<< "Point motion update" << endl;
        }

        clearGeom();
    }
    else
    {
        if (debug)
        {
            Info<< "No update" << endl;
        }
    }

    return state;
}
void Foam::primitiveMesh::reset
(
    const label nPoints,
    const label nInternalFaces,
    const label nFaces,
    const label nCells
)
{
    clearOut();

    nPoints_ = nPoints;
    nEdges_ = -1;

    nInternalFaces_ = nInternalFaces;
    nFaces_ = nFaces;
    nCells_ = nCells;

    if (debug)
    {
        Pout<< "primitiveMesh::reset : mesh reset to"
            << " nPoints:" << nPoints_
            << " nEdges:" << nEdges_
            << " nInternalFaces:" << nInternalFaces_
            << " nFaces:" << nFaces_
            << " nCells:" << nCells_
            << endl;
    }
}
Exemplo n.º 4
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MNcursesPlugin::printTable(ClientTable& table) {
	clearOut(); // Clear the screen
	updateColumnSizes(_clientTableCache);
	std::string masterAddress;
	if ( SCCoreApp )
		masterAddress = SCCoreApp->connection()->masterAddress();
	std::string str = "[ Connected to master@" + masterAddress + " ] sorting: " + _header[_activeTag];
	print(str);
	print(formatLine(_header), HIGHLIGHT);

	boost::mutex::scoped_lock lock(_dataStructureMutex);
	// std::stable_sort(_clientTableCache.begin(), _clientTableCache.end(), std::not2(SortClients(_activeTag)));
	_clientTableCache.sort(std::not2(SortClients(_activeTag)));

	// Print clients
	if ( _reverseSortOrder ) {
		for ( ClientTable::reverse_iterator it = _clientTableCache.rbegin(); it != _clientTableCache.rend(); ++it )
			print(formatLine(*it));
	}
	else {
		for (ClientTable::iterator it = _clientTableCache.begin(); it != _clientTableCache.end(); ++it)
			print(formatLine(*it));
	}

	return true;
}
void Foam::regionCouplePolyPatch::attach() const
{
    if (!attached_)
    {
        attached_ = true;
        shadow().attach();
        clearOut();
    }
}
void Foam::regionCouplePolyPatch::detach() const
{
    if (attached_)
    {
        attached_ = false;
        shadow().detach();
        clearOut();
    }
}
void PrimitivePatch<Face, FaceList, PointField, PointType>::operator=
(
    const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
)
{
    clearOut();

    FaceList<Face>::operator=(pp);
}
Exemplo n.º 8
0
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
operator=
(
    const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
)
{
    clearOut();

    FaceList<Face>::shallowCopy(pp);
}
Exemplo n.º 9
0
void Foam::surfMesh::removeZones()
{
    if (debug)
    {
        InfoInFunction << "Removing surface zones." << endl;
    }

    // Remove the surface zones
    storedZones().clear();

    clearOut();
}
Exemplo n.º 10
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MNcursesPlugin::initOut(const Config::Config&) {
	initscr();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);
	scrollok(stdscr, TRUE);
	idlok(stdscr, TRUE);
	_currentLine = 0;
	move(_currentLine, 0);
	curs_set(0); // Hide the cursor
	clearOut();

	return true;
}
Exemplo n.º 11
0
void calculateOutput() {

	clearOut();

	int firstIndex, secondIndex, resultIndex;
	float totalResult = 0;
	for (int i = 0; i < SIZE_ERROR; i++) {
		//
		for (int j = 0; j < SIZE_DERIV; j++) {
			
			firstIndex = i; //if
			secondIndex = j; //and
			resultIndex = ruleTable[i][j]; //then


			totalResult = getMin(
					errorSets[firstIndex].getMembershipValue(error),
					derivateErrorSets[secondIndex].getMembershipValue(derror));

			resultMembershipValues[resultIndex] = getMax(
					resultMembershipValues[resultIndex], totalResult);

			//Serial.print(resultIndex); Serial.print(" -- >  "); Serial.println(resultMembershipValues[resultIndex]);
		}
	}
	//defuzzify...
	float area = 0;
	float area_product = 0;
	for (int i = 0; i < SIZE_OUTPUT; i++) {

		if (resultMembershipValues[i] > 0) {
			//Serial.print(i);
			//Serial.println("=fired. ");

			area = area
					+ resultSets[i].calculateArea(resultMembershipValues[i]);
			area_product
					= area_product
							+ resultSets[i].calculateAreaProduct(resultMembershipValues[i]);
		}
		//calculate area * center of gravity / (sum of area.)
	}
	if (area != 0) {
		out = area_product / area;
		//rightMotor.setSpeed();
		//Serial.print("==> ");
		//Serial.println(out);
	}
}
Exemplo n.º 12
0
void Foam::polyMesh::removeBoundary()
{
    if (debug)
    {
        Info<< "void polyMesh::removeBoundary(): "
            << "Removing boundary patches."
            << endl;
    }

    // Remove the point zones
    boundary_.clear();
    boundary_.setSize(0);

    clearOut();
}
Exemplo n.º 13
0
void Foam::fvMesh::removeFvBoundary()
{
    if (debug)
    {
        Info<< "void fvMesh::removeFvBoundary(): "
            << "Removing boundary patches."
            << endl;
    }

    // Remove fvBoundaryMesh data first.
    boundary_.clear();
    boundary_.setSize(0);
    polyMesh::removeBoundary();

    clearOut();
}
Exemplo n.º 14
0
void tetCreatorOctree::createTets()
{
    createPointsAndAddressing();
    
    createTetsFromFacesWithCentreNode();
    
    createTetsAroundSplitEdges();
    
    createTetsAroundEdges();
    
    createTetsFromSplitFaces();
    
    clearOut();
    sortedLeaves_.setSize(0);
    
    created_ = true;
}
Exemplo n.º 15
0
// Construct from octree and mesh data
tetCreatorOctree::tetCreatorOctree
(
    const meshOctree& octree,
    const IOdictionary& meshDict
)
:
    octreeCheck_(octree, meshDict, true),
    tetPoints_(),
    tets_(),
    sortedLeaves_(),
    subNodeLabelsPtr_(NULL),
    cubeLabelPtr_(NULL),
    faceCentreLabelPtr_(NULL),
    created_(false)
{
    createTets();
    
    clearOut();
}
void PatchToPatchInterpolation<FromPatch, ToPatch>::setWeights
(
    labelList* paPtr,
    FieldField<Field, scalar>* pwPtr,
    scalarField* pdPtr,
    labelList* faPtr,
    FieldField<Field, scalar>* fwPtr,
    scalarField* fdPtr
)
{
    clearOut();

    pointAddressingPtr_ = paPtr;
    pointWeightsPtr_ = pwPtr;
    pointDistancePtr_ = pdPtr;
    faceAddressingPtr_ = faPtr;;
    faceWeightsPtr_ = fwPtr;
    faceDistancePtr_ = fdPtr;;
}
Exemplo n.º 17
0
void Foam::polyMesh::removeZones()
{
    if (debug)
    {
        Info<< "void polyMesh::removeZones(): "
            << "Removing point, face and cell zones."
            << endl;
    }

    // Remove the zones
    pointZones_.clear();
    pointZones_.setSize(0);

    faceZones_.clear();
    faceZones_.setSize(0);

    cellZones_.clear();
    cellZones_.setSize(0);

    clearOut();
}
Exemplo n.º 18
0
PatchToPatchInterpolation<FromPatch, ToPatch>::~PatchToPatchInterpolation()
{
    clearOut();
}
void Foam::regionCouplePolyPatch::updateMesh()
{
    polyPatch::updateMesh();
    clearOut();
}
Foam::overlapGgiPolyPatch::~overlapGgiPolyPatch()
{
    clearOut();
}
Foam::regionCouplePolyPatch::~regionCouplePolyPatch()
{
    clearOut();
}
Exemplo n.º 22
0
tetCreatorOctree::~tetCreatorOctree()
{
    clearOut();
}
Exemplo n.º 23
0
Foam::surfaceInterpolation::~surfaceInterpolation()
{
    clearOut();
}
Exemplo n.º 24
0
bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
{
    clearOut();

    return true;
}
Exemplo n.º 25
0
Foam::fvMesh::~fvMesh()
{
    clearOut();
}
void eMesh::resetPrimitives
(
    edgeList& edges,
    labelListList& faceEdges,
    labelListList& edgeFaces,
    const labelList& patchSizes,
    const labelList& patchStarts,
    const bool reUse,
    const bool storePrimitives
)
{
    // Clear out geometry and addressing
    clearOut();

    // Initialize pointers for storage
    if (storePrimitives)
    {
        fePtr_ =
        (
            new labelListIOList
            (
                IOobject
                (
                    "faceEdges",
                    mesh_.facesInstance(),
                    meshSubDir,
                    mesh_,
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                )
            )
        );

        efPtr_ =
        (
            new labelListIOList
            (
                IOobject
                (
                    "edgeFaces",
                    mesh_.facesInstance(),
                    meshSubDir,
                    mesh_,
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                )
            )
        );

        if (reUse)
        {
            edges_.transfer(edges);
            fePtr_->transfer(faceEdges);
            efPtr_->transfer(edgeFaces);
        }
        else
        {
            edges_ = edges;
            fePtr_->operator=(faceEdges);
            efPtr_->operator=(edgeFaces);
        }
    }

    // Reset patch sizes and starts
    forAll(boundary_, patchI)
    {
        boundary_[patchI] = ePatch
        (
            boundary_[patchI].name(),
            patchSizes[patchI],
            patchStarts[patchI],
            patchI,
            boundary_
        );
    }
cartesianMeshExtractor::~cartesianMeshExtractor()
{
    clearOut();
}
Exemplo n.º 28
0
Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
{
    if (debug)
    {
        Info<< "polyMesh::readUpdateState polyMesh::readUpdate() : "
            << "Updating mesh based on saved data." << endl;
    }

    // Find the point and cell instance
    fileName pointsInst(time().findInstance(meshDir(), "points"));
    fileName facesInst(time().findInstance(meshDir(), "faces"));

    if (debug)
    {
        Info<< "Faces instance: old = " << facesInstance()
            << " new = " << facesInst << nl
            << "Points instance: old = " << pointsInstance()
            << " new = " << pointsInst << endl;
    }

    if (facesInst != facesInstance())
    {
        // Topological change
        if (debug)
        {
            Info<< "Topological change" << endl;
        }

        clearOut();

        // Set instance to new instance. Note that points instance can differ
        // from from faces instance.
        setInstance(facesInst);
        points_.instance() = pointsInst;

        points_ = pointIOField
        (
            IOobject
            (
                "points",
                pointsInst,
                meshSubDir,
                *this,
                IOobject::MUST_READ,
                IOobject::NO_WRITE,
                false
            )
        );

        faces_ = faceCompactIOList
        (
            IOobject
            (
                "faces",
                facesInst,
                meshSubDir,
                *this,
                IOobject::MUST_READ,
                IOobject::NO_WRITE,
                false
            )
        );

        owner_ = labelIOList
        (
            IOobject
            (
                "owner",
                facesInst,
                meshSubDir,
                *this,
                IOobject::READ_IF_PRESENT,
                IOobject::NO_WRITE,
                false
            )
        );

        neighbour_ = labelIOList
        (
            IOobject
            (
                "neighbour",
                facesInst,
                meshSubDir,
                *this,
                IOobject::READ_IF_PRESENT,
                IOobject::NO_WRITE,
                false
            )
        );

        // Reset the boundary patches
        polyBoundaryMesh newBoundary
        (
            IOobject
            (
                "boundary",
                facesInst,
                meshSubDir,
                *this,
                IOobject::MUST_READ,
                IOobject::NO_WRITE,
                false
            ),
            *this
        );

        // Check that patch types and names are unchanged
        bool boundaryChanged = false;

        if (newBoundary.size() != boundary_.size())
        {
            boundaryChanged = true;
        }
        else
        {
            wordList newTypes = newBoundary.types();
            wordList newNames = newBoundary.names();

            wordList oldTypes = boundary_.types();
            wordList oldNames = boundary_.names();

            forAll(oldTypes, patchI)
            {
                if
                (
                    oldTypes[patchI] != newTypes[patchI]
                 || oldNames[patchI] != newNames[patchI]
                )
                {
                    boundaryChanged = true;
                    break;
                }
            }
        }

        if (boundaryChanged)
        {
            WarningIn("polyMesh::readUpdateState polyMesh::readUpdate()")
                << "Number of patches has changed.  This may have "
                << "unexpected consequences.  Proceed with care." << endl;

            boundary_.clear();
            boundary_.setSize(newBoundary.size());

            forAll(newBoundary, patchI)
            {
                boundary_.set(patchI, newBoundary[patchI].clone(boundary_));
            }
        }
        else
        {
Exemplo n.º 29
0
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
~PrimitivePatch()
{
    clearOut();
}
Foam::primitiveMesh::~primitiveMesh()
{
    clearOut();
}