void Foam::readerDatabase::loadMesh()
{
    deleteDemandDrivenData(meshPtr_);

    Info<< "Loading new mesh" << endl;

    meshPtr_ = new fvMeshSubset
    (
        *runTimePtr_,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    );

    if (setName_.size())
    {
        Info<< "Subsetting mesh based on cellSet " << setName_ << endl;

        fvMeshSubset& mesh = *meshPtr_;

        cellSet currentSet(mesh, setName_);

        mesh.setCellSubset(currentSet);
    }
    getPolyHedra();
}
Пример #2
0
// Construct from components
Foam::vtkMesh::vtkMesh
(
    const IOobject& io,
    const word& setName
)
:
    fvMesh(io),
    subsetMesh_
    (
        IOobject
        (
            "subset",
            io.time().constant(),
            *this,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        *this
    ),
    setName_(setName)
{
    if (setName.size())
    {
        // Read cellSet using whole mesh
        cellSet currentSet(*this, setName_);

        // Set current subset
        subsetMesh_.setLargeCellSubset(currentSet);
    }
}
Пример #3
0
/* StyleSet::loadSet
 * Loads the style set at [index] to the current style set. Returns
 * false if [index] was out of bounds, true otherwise
 *******************************************************************/
bool StyleSet::loadSet(unsigned index)
{
	// Check index
	if (index >= style_sets.size())
		return false;

	currentSet()->copySet(style_sets[index]);

	return true;
}
Пример #4
0
//-----------------------------------------------------------------------------
//! 
//-----------------------------------------------------------------------------
void tStartLineTacticalWidget::UpdateTideArrow()
{
    float setR = 0;
    float lineBearingR = 0;
    float currentRateKn = 0;

    // tide set
    tDigitalData currentSet( DATA_TYPE_CURRENT_SET );
    bool setOk = currentSet.DampedValidValue(setR);

    // tide rate
    tDigitalData currentRate( DATA_TYPE_CURRENT_DRIFT );
    bool rateOk = currentRate.DampedValidValue(currentRateKn);

    // line bearing
    tDigitalData lineBearing( DATA_TYPE_START_LINE_BEARING );
    bool lineOk = lineBearing.DampedValidValue( lineBearingR );
    
    bool showTideArrow = false;

    if ( setOk && rateOk && lineOk )
    {
        float angleR = setR - ( lineBearingR + PI_2f );
        NormaliseRadiansF( angleR );
        m_pTideArrow->SetAngle( qRound( RadiansToDegreesf( angleR ) ) );
        showTideArrow = true;

        if( currentRateKn < 0.05f )
        {
            showTideArrow = false;
        }
        else if( currentRateKn < 1.0f )
        {
            m_pTideArrow->SetScale( currentRateKn );
            showTideArrow = true;
        }
        else
        {
            m_pTideArrow->SetScale( 1.0f );
            showTideArrow = true;
        }
    }
    else
    {
        showTideArrow = false;
    }

    m_pTideArrow->setVisible( showTideArrow );
}
Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime
(
    const instant& timeInstance,
    const label timeIndex
)
{
    runTime().setTime(timeInstance, timeIndex);

    polyMesh::readUpdateState meshChange;

    if (meshPtr_)
    {
        // Update loaded mesh
        meshChange = meshPtr_->readUpdate();

        if (setName_.size() && meshChange != polyMesh::UNCHANGED)
        {
            Info<< "Subsetting mesh based on " << setName_ << endl;

            fvMeshSubset& mesh = *meshPtr_;

            cellSet currentSet(mesh, setName_);

            mesh.setCellSubset(currentSet);
        }

        if
        (
            (meshChange == polyMesh::TOPO_CHANGE)
         || (meshChange == polyMesh::TOPO_PATCH_CHANGE)
        )
        {
            getPolyHedra();
        }
    }
    else
    {
        // Force new mesh to be loaded for current time
        loadMesh();
        meshChange = polyMesh::TOPO_CHANGE;
    }

    return meshChange;
}
Пример #6
0
// Construct from components
Foam::vtkMesh::vtkMesh
(
    fvMesh& baseMesh,
    const word& setName
)
:
    baseMesh_(baseMesh),
    subsetter_(baseMesh),
    setName_(setName)
{
    if (setName.size())
    {
        // Read cellSet using whole mesh
        cellSet currentSet(baseMesh_, setName_);

        // Set current subset
        subsetter_.setLargeCellSubset(currentSet);
    }
}
Пример #7
0
Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
{
    polyMesh::readUpdateState meshState = fvMesh::readUpdate();

    if (meshState != polyMesh::UNCHANGED)
    {
        // Note: since fvMeshSubset has no movePoints() functionality,
        //  reconstruct the subset even if only movement.

        topoPtr_.clear();

        if (setName_.size())
        {
            Info<< "Subsetting mesh based on cellSet " << setName_ << endl;

            // Read cellSet using whole mesh
            cellSet currentSet(*this, setName_);

            subsetMesh_.setLargeCellSubset(currentSet);
        }
    }

    return meshState;
}
Пример #8
0
/* StyleSet::applyCurrent
 * Applies the current style set to the scintilla text control [stc]
 *******************************************************************/
void StyleSet::applyCurrent(wxStyledTextCtrl* stc)
{
	currentSet()->applyTo(stc);
}
Пример #9
0
/* StyleSet::applyCurrent
 * Applies the current style set to the scintilla text control [stc]
 *******************************************************************/
void StyleSet::applyCurrent(TextEditor* stc)
{
	currentSet()->applyTo(stc);
}
Foam::subsetMotionSolverFvMesh::subsetMotionSolverFvMesh(const IOobject& io)
:
    dynamicFvMesh(io),
    movingMeshCoeffs_
    (
        IOdictionary
        (
            IOobject
            (
                "dynamicMeshDict",
                io.time().constant(),
                *this,
                IOobject::MUST_READ,
                IOobject::NO_WRITE
            )
        ).subDict(typeName + "Coeffs")
    ),
    subsetMesh_
    (
        IOobject
        (
            "motion",
            io.time().constant(),
            *this,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        *this
    ),
    motionPtr_(NULL),
    alpha_(readScalar(movingMeshCoeffs_.lookup("alpha")))
{
    // Create subset
    word setName = movingMeshCoeffs_.lookup("set");

    cellSet currentSet
    (
        IOobject
        (
            setName,
            io.time().constant(),
            polyMesh::meshSubDir/"sets",
            *this,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    subsetMesh_.setLargeCellSubset(currentSet, -1);

    // Create motion solver on the subset
    motionPtr_ = motionSolver::New(subsetMesh_.subMesh());

    // Read motion under-relaxation
    if (alpha_ < 0 || alpha_ > 1.0)
    {
        FatalErrorIn
        (
            "subsetMotionSolverFvMesh::subsetMotionSolverFvMesh"
            "(const IOobject& io)"
        )   << "Ill-defined motion under-relaxation: "
            << "should be between 0 and 1."
            << "  Alpha = " << alpha_ << abort(FatalError);
    }
}