Foam::ParticleForceList<CloudType>::ParticleForceList
(
    CloudType& owner,
    const fvMesh& mesh,
    const dictionary& dict,
    const bool readFields
)
:
    PtrList<ParticleForce<CloudType> >(),
    owner_(owner),
    mesh_(mesh),
    dict_(dict)
{
    if (readFields)
    {
        wordList modelNames(dict.toc());

        Info<< "Constructing particle forces" << endl;

        if (modelNames.size() > 0)
        {
            this->setSize(modelNames.size());

            label i = 0;
            forAllConstIter(IDLList<entry>, dict, iter)
            {
                const word& model = iter().keyword();
                if (iter().isDict())
                {
                    this->set
                    (
                        i++,
                        ParticleForce<CloudType>::New
                        (
                            owner,
                            mesh,
                            iter().dict(),
                            model
                        )
                    );
                }
                else
                {
                    this->set
                    (
                        i++,
                        ParticleForce<CloudType>::New
                        (
                            owner,
                            mesh,
                            dict,
                            model
                        )
                    );
                }
            }
        }
        else
        {
Пример #2
0
void    ModelDependencies (_SimpleList& lfs, long modelID)
{
    for (long k=0; k< likeFuncNamesList.lLength; k++)
        if (((_String*)likeFuncNamesList(k))->sLength)
            if (((_LikelihoodFunction*)likeFuncList(k))->DependOnModel (*(_String*)modelNames(modelID))>=0) {
                lfs << k;
            }
}
Пример #3
0
void VisibleEntity::makeGUI(class GuiPane* pane, class GApp* app) {
    Entity::makeGUI(pane, app);

    Array<String> modelNames("<none>");
    int selected = 0;
    for (ModelTable::Iterator it = m_scene->modelTable().begin(); it.hasMore(); ++it) {        
        modelNames.append(it->key + " (" + it->value->className() + ")");
        if (it->value == m_model) {
            selected = modelNames.size() - 1;
        }
    }
    m_modelDropDownList = pane->addDropDownList("Model", modelNames, NULL, GuiControl::Callback(this, &VisibleEntity::onModelDropDownAction));
    m_modelDropDownList->setSelectedIndex(selected);
    pane->addCheckBox("Visible", &m_visible);
}
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
(
    regionModel& owner,
    const dictionary& dict,
    const bool readFields
)
:
    PtrList<regionModelFunctionObject>(),
    owner_(owner),
    dict_(dict)
{
    if (readFields)
    {
        wordList modelNames(dict.toc());

        Info<< "    Selecting region model functions" << endl;

        if (modelNames.size() > 0)
        {
            this->setSize(modelNames.size());

            forAll(modelNames, i)
            {
                const word& modelName = modelNames[i];

                this->set
                (
                    i,
                    regionModelFunctionObject::New
                    (
                        dict,
                        owner,
                        modelName
                    )
                );
            }
        }
        else
        {
Foam::CloudFunctionObjectList<CloudType>::CloudFunctionObjectList
(
    CloudType& owner,
    const dictionary& dict,
    const bool readFields
)
:
    PtrList<CloudFunctionObject<CloudType> >(),
    owner_(owner),
    dict_(dict)
{
    if (readFields)
    {
        wordList modelNames(dict.toc());

        Info<< "Constructing cloud functions" << endl;

        if (modelNames.size() > 0)
        {
            this->setSize(modelNames.size());

            forAll(modelNames, i)
            {
                const word& modelName = modelNames[i];

                this->set
                (
                    i,
                    CloudFunctionObject<CloudType>::New
                    (
                        dict,
                        owner,
                        modelName
                    )
                );
            }
        }
        else
        {
Пример #6
0
void VisibleEntity::makeGUI(class GuiPane* pane, class GApp* app) {
    Entity::makeGUI(pane, app);

    Array<String> modelNames("<none>");
    int selected = 0;
    for (ModelTable::Iterator it = m_scene->modelTable().begin(); it.hasMore(); ++it) {      
        const lazy_ptr<Model>& m = it->value;

        if (m.resolved()) {
            modelNames.append(it->key + " (" + it->value.resolve()->className() + ")");
        } else {
            // The model type is unknown because it hasn't been loaded yet
            modelNames.append(it->key);
        }

        if (it->value == m_model) {
            selected = modelNames.size() - 1;
        }
    }
    m_modelDropDownList = pane->addDropDownList("Model", modelNames, NULL, GuiControl::Callback(this, &VisibleEntity::onModelDropDownAction));
    m_modelDropDownList->setSelectedIndex(selected);
    pane->addCheckBox("Visible", &m_visible);
}
Пример #7
0
void    _HYObjectInspector::BuildListOfObjects (long index)
{
    _HYTable*       oList = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0);
    _HYTable*       oHead = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW-1,0);
    _HYButtonBar*   b1    = (_HYButtonBar*)GetCellObject (0,0);
    _HYPullDown*    p1    = (_HYPullDown*)GetCellObject (0,2);

    long            k,
                    rowCount = 0;

    oList->ClearTable();

    _String newStat;

    switch (index) {
    case 0: { // trees
        for (k=0; k<variablePtrs.lLength; k++) {
            _Variable * thisVar = LocateVar(k);
            if (thisVar&&(thisVar->ObjectClass()==TREE)) {
                oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);
                _SimpleList deps;
                TreeDependencies    (deps,thisVar->GetAVariable());
                if (deps.lLength) {
                    oList->SetCellData (thisVar->GetName(),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_BOLD,true);
                } else {
                    oList->SetCellData (thisVar->GetName(),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true);
                }
                _TheTree * thisTree = (_TheTree*)thisVar;
                _PMathObj tc = thisTree->TipCount();
                newStat = _String ((long)tc->Value()) & " leaves ";
                DeleteObject (tc);
                tc = thisTree->BranchCount();
                newStat = newStat& ", " & _String ((long)tc->Value()+1) & " internal nodes.";
                DeleteObject (tc);
                oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true);
                rowCount++;
            }
        }
        b1->EnableButton (2,true);
        b1->EnableButton (3,true);
        break;
    }
    case 1: { // data sets
        for (k=0; k<dataSetNamesList.lLength; k++) {
            _String* thisDS = (_String*)dataSetNamesList(k);
            if (thisDS->sLength) {
                oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);
                _SimpleList deps;
                DSDependencies  (deps,k);
                if (deps.lLength) {
                    oList->SetCellData (thisDS,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_BOLD,true);
                } else {
                    oList->SetCellData (thisDS,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true);
                }
                _DataSet*  theDS = (_DataSet*)dataSetList(dataSetNamesList.Find(thisDS));
                if (theDS->GetTT()->IsStandardNucleotide()) {
                    newStat = "Nucleotide data";
                } else if (theDS->GetTT()->IsStandardAA()) {
                    newStat = "Aminoacid data";
                } else if (theDS->GetTT()->IsStandardBinary()) {
                    newStat = "Binary data";
                } else {
                    newStat = "Custom data";
                }

                newStat = newStat & ". "& _String (theDS->NoOfColumns()) &" sites ("&_String (theDS->NoOfUniqueColumns())&" distinct patterns), "&_String(theDS->NoOfSpecies())& " species.";
                oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true);
                rowCount++;
            }
        }
        b1->EnableButton (2,true);
        b1->EnableButton (3,false);
        break;
    }
    case 2: { // Models
        for (k=0; k<modelTemplates.lLength; k++) {
            _List       * thisModel       = (_List*) modelTemplates(k);
            _SimpleList * modelParameters = (_SimpleList*) (*thisModel)(1);

            oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);

            if (modelParameters->lData[0] & HY_DATAPANEL_MODEL_MODELS) {
                oList->SetCellData ((*thisModel)(0),rowCount,0,HY_TABLE_STATIC_TEXT,true);
            } else {
                oList->SetCellData ((*thisModel)(0),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true);
            }

            if (modelParameters->lData[1]==4) {
                newStat = "Nucleotide model";
            } else if (modelParameters->lData[1]==16) {
                newStat = "Dinucleotide Model";
            } else if (modelParameters->lData[1]==20) {
                newStat = "Aminoacid Model";
            } else {
                newStat = "Codon Model";
            }

            newStat = newStat & ".";
            oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true);
            rowCount++;
        }

        for (k=0; k<modelNames.lLength; k++) {
            _String * modelID = (_String*)modelNames(k);
            if (modelID->sLength) {
                oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);

                _SimpleList deps;
                ModelDependencies   (deps,k);

                if (deps.lLength) {
                    oList->SetCellData (modelID,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_BOLD,true);
                } else {
                    oList->SetCellData (modelID,rowCount,0,HY_TABLE_STATIC_TEXT,true);
                }

                _Matrix * modelMatrix = (_Matrix*)LocateVar (modelMatrixIndices.lData[k])->GetValue();

                long    mDim = modelMatrix->GetHDim();

                if (mDim==4) {
                    newStat = "Nucleotide model";
                } else if (mDim==16) {
                    newStat = "Dinucleotide Model";
                } else if (mDim==20) {
                    newStat = "Aminoacid Model";
                } else {
                    newStat = "Codon Model";
                }

                newStat = newStat & ".";
                oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true);
                rowCount++;
            }
        }

        b1->EnableButton (2,true);
        b1->EnableButton (3,true);
        break;
    }
    case 3: { // likelihood functions
        for (k=0; k<likeFuncNamesList.lLength; k++) {
            _String *lfName = (_String*)likeFuncNamesList (k);

            if (lfName->sLength) {
                oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);
                oList->SetCellData (lfName,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_BOLD,true);
                _LikelihoodFunction *lf = (_LikelihoodFunction*)likeFuncList (k);
                newStat = _String ("Likelihood Function on ") & (long)lf->GetTheTrees().lLength & " partitions/trees.";

                oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true);
                rowCount++;
            }
        }
        b1->EnableButton (2,true);
        b1->EnableButton (3,false);
        break;
    }
    }
    if (rowCount==0) {
        newStat = _String("No ")& *p1->GetMenuItem(index) &" found.";
        oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT);
        oList->SetCellData (&newStat,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_CANTSELECT,true);
        oList->SetCellData (&empty,rowCount,1,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_CANTSELECT,true);
        rowCount ++;
    } else if (rowCount>1) {
        newStat = _String (rowCount) & ' ' & *p1->GetMenuItem(index) &" found.";
    } else {
        newStat = _String("One ") & p1->GetMenuItem(index)->Cut(0,p1->GetMenuItem(index)->sLength-2) & " found.";
    }

    if (rowCount<5) {
        oList->AddRow (-1,(5-rowCount)*20,HY_TABLE_STATIC_TEXT|HY_TABLE_CANTSELECT);
    }

    SetStatusBar (newStat);
    oList -> AutoFitWidth (*oHead);
    rowCount = oHead->GetMaxW();
    if (rowCount<oHead->rel.right-oHead->rel.left) {
        oList->SetColumnSpacing (1,-rowCount+oHead->rel.right-oHead->rel.left+1,false);
        oHead->SetColumnSpacing (1,-rowCount+oHead->rel.right-oHead->rel.left+1,false);
    }
    rowCount = oList->GetMaxH();
    if (rowCount<=oList->rel.bottom-oList->rel.top) {
        oList->SetRowSpacing (oList->verticalSpaces.lLength-1,oList->rel.bottom-oList->rel.top+1-rowCount,false);
    }

    oList->SetVisibleSize(oList->rel);
    oHead->SetVisibleSize(oHead->rel);
    oList->_MarkForUpdate ();
    oHead->_MarkForUpdate ();
#ifdef __HYPHY_GTK__
    UpdateComponentInfo ();
#else
    dim = MinMaxWindowDimensions();
#endif
}