Example #1
0
/* Function: SimStart =======================================================
 * Abstract:
 *    This function is called once at start of model execution. If you
 *    have states that should be initialized once, this is the place
 *    to do it.
 */
void SimStart(SimStruct *S)
{
    //printf("---SimStart---\n");

    Sim *sim = createSim(S);   		 // create new sim object
    ssGetPWork(S)[0] = (void *) sim; // store new C++ object in the pointers vector

    try
    {
        sim->start();
    }
    catch(Exception e)
    {
        e.kill(S);
        return;
    }
}
Example #2
0
SimulationSelector::SimulationSelector(QWidget *parent) :
    QWidget(parent)
{
    int i = 0;
    MACRenderData data[] =
    {
        MACRenderData("Liquid Phi"       , 0 , MACViewerWidget::GT_CELL        ),//0
        MACRenderData("U Flux"           , 1 , MACViewerWidget::GT_UFLUX       ),//1
        MACRenderData("V Flux"           , 2 , MACViewerWidget::GT_VFLUX       ),//2
        MACRenderData("W Flux"           , 3 , MACViewerWidget::GT_WFLUX       ),//3
        MACRenderData("U Weights"        , 4 , MACViewerWidget::GT_UFLUX       ),//4
        MACRenderData("V Weights"        , 5 , MACViewerWidget::GT_VFLUX       ),//5
        MACRenderData("W Weights"        , 6 , MACViewerWidget::GT_WFLUX       ),//6
        MACRenderData("Pressure"         , 7 , MACViewerWidget::GT_CELL        ),//7
        MACRenderData("RHS"              , 8 , MACViewerWidget::GT_CELL        ),//8
        MACRenderData("Solid Phi"        , 9 , MACViewerWidget::GT_VERTEX      ),//9
        MACRenderData("Solid Boundary"   , 9 , MACViewerWidget::GT_PARTICLE    ),//10
        //MACRenderData("Liquid Surface"   , 0 , MACViewerWidget::GT_VERTEX ),//11
        MACRenderData("Liquid Surface"   , 0 , MACViewerWidget::GT_MARCHINGCUBE        ),//11
        MACRenderData("Particles"        , 11 , MACViewerWidget::GT_PARTICLE    ),//12
        MACRenderData("Velocity"         , 1 , MACViewerWidget::GT_VELOCITY    ),//13
        MACRenderData("Vorticity"        , 10 , MACViewerWidget::GT_VERTEX      ),//14
        MACRenderData("Weight Velcoity "        , 4 , MACViewerWidget::GT_VELOCITY      ),//15


    };
    dataProfile.data.assign(data,data+sizeof(data)/sizeof(MACRenderData));
    int max=0;
    for(auto it = dataProfile.data.begin(); it != dataProfile.data.end(); ++it)
    {
        max = std::max(it->index, max);
    }
    dataProfile.numBuffers=max+1;


    QGroupBox * simTypes = new QGroupBox("Simulation types",this);
    QVBoxLayout * simTypeLayout = new QVBoxLayout;

    listview = new QListView();
    connect(listview, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectedChanged(const QModelIndex &)));

    QStandardItemModel* model = new QStandardItemModel();
    for(int i=0; i<name_size; ++i)
    {
        QStandardItem * item = new QStandardItem(names[i]);
        item->setData(QVariant(i));

        model->appendRow(item);
    }
    listview->setModel(model);
    simTypeLayout->addWidget(listview);
    simTypes->setLayout(simTypeLayout);
    QVBoxLayout * layout = new QVBoxLayout;
    layout ->addWidget(simTypes);
    this->setLayout(layout);
    QPushButton * button = new QPushButton("Create Simulation", this);
    connect(button, SIGNAL(clicked()), this, SLOT(createSim()));
    layout->addWidget(button);




















}