示例#1
0
ReadHyperMesh::ReadHyperMesh(int argc, char **argv)
    : coSimpleModule(argc, argv, "Read Altair HyperMesh files")
{
    // module parameters

    fileName = addFileBrowserParam("MeshFileName", "dummy");
    fileName->setValue("./", "*.hm*");
    resultsFileName = addFileBrowserParam("ReslutFileName", "dummy");
    resultsFileName->setValue("./", "*.hm*;*.fma");

    subdivideParam = addBooleanParam("subdivide", "Subdivide tet10 and hex20 elements");
    subdivideParam->setValue(true);

    p_numt = addInt32Param("numt", "Nuber of Timesteps to read");
    p_numt->setValue(1000);
    p_skip = addInt32Param("skip", "Nuber of Timesteps to skip");
    p_skip->setValue(0);

    p_Selection = addStringParam("Selection", "Parts to load");
    p_Selection->setValue("0-9999999");

    // Output ports
    mesh = addOutputPort("mesh", "UnstructuredGrid", "Unstructured Grid");
    mesh->setInfo("Unstructured Grid");
    char buf[1000];
    int i;
    for (i = 0; i < NUMRES; i++)
    {
        sprintf(buf, "data%d", i);
        dataPort[i] = addOutputPort(buf, "Float|Vec3", buf);
        dataPort[i]->setInfo(buf);
    }
}
示例#2
0
ReadN3s::ReadN3s(int argc, char *argv[])
{
    char buf[255], buf1[255];
    char buf2[255];
    int i;
    char *geo_data_path;
    char *res_data_path;
    set_module_description("Generic ASCII-File Reader for N3S 3.2");

    // the output port
    unsgridPort = addOutputPort("mesh", "coDoUnstructuredGrid", "geometry ");

    for (i = 0; i < MAX_PORTS_N3S; i++)
    {
        sprintf(buf, "dataport%d", i + 1);
        dataPort[i] = addOutputPort(buf, "coDoVec3 | coDoFloat | DO_Unstructured_V2D_Data | coDoVec2", buf);
    }
    // select the OBJ file name with a file browser
    geoFileParam = addFileBrowserParam("n3s geofile", "N3S geofile");
    resFileParam = addFileBrowserParam("n3s result file", "N3S result file");
    char *cov_path = getenv("COVISEDIR");
    geo_data_path = new char[255];
    res_data_path = new char[255];
    if (cov_path)
    {
        sprintf(geo_data_path, "%s/data/n3s/* ", cov_path);
        sprintf(res_data_path, "%s/data/n3s/* ", cov_path);
    }
    else
    {
        sprintf(geo_data_path, "./* ");
        sprintf(res_data_path, "./* ");
    }
    cerr << "buf: " << geo_data_path << endl;
    geoFileParam->setValue(geo_data_path, "geom");
    resFileParam->setValue(res_data_path, "post.res");
    //    resFileParam->setValue("post.res result", buf);

    return;

    choice_of_data[0] = new char[10]; // die gibt's immer
    strcpy(choice_of_data[0], "(none)\n");
    for (i = 0; i < MAX_PORTS_N3S; i++)
    {
        sprintf(buf1, "data%d", i);
        sprintf(buf2, "select data%d", i);
        choiceData[i] = addChoiceParam(buf1, buf2);
        choiceData[i]->setValue(1, choice_of_data, 1);
    }
}
示例#3
0
ReadIVDTubes::ReadIVDTubes(int argc, char *argv[])
    : coModule(argc, argv, "Read IVD lines in DX format's")
{
    // module parameters

    m_pParamFile = addFileBrowserParam("Filename", "dummy");

    m_pParamFile->setValue("./", "*.dx");

    // Output ports
    m_portLines = addOutputPort("lines", "Lines", "center lines");
    m_portLines->setInfo("Center Lines");

    m_varPorts = new coOutputPort *[NUM_SCALAR];
    m_varPorts[0] = addOutputPort("DELTAT", "Float", "Darstellung Abweichung von der mittleren Segmentemperatur AS");
    m_varPorts[1] = addOutputPort("TAS", "Float", "Temperaturdarstellung AS");
    m_varPorts[2] = addOutputPort("FAS", "Float", "Massenstrom");
    m_varPorts[3] = addOutputPort("PAS", "Float", "Druck");
    m_varPorts[4] = addOutputPort("VAS", "Float", "spez. Volumen");
    m_varPorts[5] = addOutputPort("XAS", "Float", "Dampfgehalt");
    m_varPorts[6] = addOutputPort("CAS", "Float", "cp");
    m_varPorts[7] = addOutputPort("HAS", "Float", "Enthalpie");
    m_varPorts[8] = addOutputPort("TW", "Float", "Wandtemperatur");
    m_varPorts[9] = addOutputPort("TRG", "Float", "Temperatur Rauchgas");
    m_varPorts[10] = addOutputPort("QMS", "Float", "Waermestromdichte");
    m_varPorts[11] = addOutputPort("QMR", "Float", "Waermestromdichte Rauchgas");
    m_varPorts[12] = addOutputPort("Velo", "Float", "Geschw. Wasserdampf");
    m_varPorts[13] = addOutputPort("TWRG", "Float", "Wandtemperatur Rauchgas");
}
示例#4
0
文件: ReadMeteo.cpp 项目: nixz/covise
/// Constructor
coReadMeteo::coReadMeteo(int argc, char *argv[])
    : coModule(argc, argv, "Read files to create a list of points (stars) and scalar parameters.")
    , lineBuf(NULL)
    , lineBufSize(0)
{

    // Create ports:
    poData = addOutputPort("Data", "StructuredGrid|Float", "Height Field or data");
    poData->setInfo("Height field or data");

    // Create parameters:
    pbrFile = addFileBrowserParam("FilePath", "First file of sequence or single file");
    pbrFile->setValue("data/", "*");

    pDimX = addInt32Param("DimX", "X Dimension");
    pDimX->setValue(40);

    pDimY = addInt32Param("DimY", "Y Dimension");
    pDimY->setValue(40);

    pDimZ = addInt32Param("DimZ", "Z Dimension");
    pDimZ->setValue(16);

    pScale = addFloatParam("Scale", "Scale factor");
    pScale->setValue(0.001f);

    pboDataMode = addBooleanParam("DataMode", "Read files as data (instead of height information)");
    pboDataMode->setValue(true);

    pboWarnings = addBooleanParam("Warnings", "Display warnings when reading files");
    pboWarnings->setValue(true);
}
示例#5
0
ReadStarDrop::ReadStarDrop(int argc, char *argv[])
    : coModule(argc, argv, "Star Droplet file reader")
{
#ifdef VERBOSE
    debug = fopen("DEBUG", "w");
#endif

    // the LoopThrough data
    p_grid_out = addOutputPort("grid_out", "UnstructuredGrid", "multiplexed grid");
    p_grid_in = addInputPort("grid_in", "UnstructuredGrid", "grid set with REALTIME attribute");

    int i;
    char buf[16];
    for (i = 0; i < NUM_DATA_PORTS; i++)
    {
        sprintf(buf, "dataOut_%d", i);
        p_dataOut[i] = addOutputPort(buf, "Vec3|Float|Polygons|Lines|IntArr|Geometry", "data set to multiplex");
        sprintf(buf, "dataIn_%d", i);
        p_dataIn[i] = addInputPort(buf, "Vec3|Float|Polygons|Lines|IntArr|Geometry", "data set to multiplex");
        p_dataIn[i]->setRequired(0);
        p_dataOut[i]->setDependencyPort(p_dataIn[i]);
    }

    // the output ports
    p_dropOut[LOCA] = addOutputPort("location", "Points", "Droplet Location");
    p_dropOut[VELO] = addOutputPort("velocity", "Vec3", "Droplet velocity");
    p_dropOut[TEMP] = addOutputPort("temp", "Float", "Droplet Temperature");
    p_dropOut[DIAM] = addOutputPort("diameter", "Float", "Droplet Diameter");
    p_dropOut[MASS] = addOutputPort("mass", "Float", "Droplet Mass");
    p_dropOut[COUN] = addOutputPort("count", "Float", "Droplet Count");

    // hand out the mapping for additional loop-thru multiplier modules
    p_mapping = addOutputPort("mapping", "IntArr", "Grid multiplication mapping");

    // select the Droplet file name with a file browser
    p_filename = addFileBrowserParam("filename", "Droplet File");
    p_filename->setValue("data/track.trk", "*.trk;*.33");

    // how often to multiply the input data
    p_maxDrops = addInt32Param("maxPart", "Max. no. of Particles to show, 0=all");
    p_maxDrops->setValue(0);

    // how often to multiply the input data
    p_numSteps = addInt32Param("numSteps", "Number of steps to use, 0=auto");
    p_numSteps->setValue(0);

    // whether to do artificial termination or not
    p_stickHandling = addChoiceParam("stickHandling", "How to handle sticked droplets");
    static const char *labels[] = { "No stuck Droplets", "Both", "Only stuck" };
    p_stickHandling->setValue(3, labels, 0);

    // init local data
    d_lastFileName = NULL;
    d_dropArr = NULL;
    d_numDrops = 0;
}
示例#6
0
文件: ReadNas.cpp 项目: nixz/covise
// Module set-up in Constructor
ReadNas::ReadNas(int argc, char *argv[])
    : coModule(argc, argv, "Read NAS")
{
    // file browser parameter
    p_filename = addFileBrowserParam("file_path", "Data file path");
    p_filename->setValue("data/nofile.nas", "*.nas;*.NAS;*");

    // Output ports
    p_polyOut = addOutputPort("mesh", "Polygons", "Polygons");

    d_file = NULL;
}
示例#7
0
Patran::Patran(int argc, char *argv[])
    : coModule(argc, argv, "Read Patran Neutral Files")
{
    const char *ChoiseVal[] = {
        "Nodal_Results", "Element_Results",
    };
    strcpy(init_path, "data/nofile");

    //parameters
    p_gridpath = addFileBrowserParam("grid_path", "Neutral File path");
    p_gridpath->setValue(init_path, "*");
    p_displpath = addFileBrowserParam("nodal_displ_force_path", "Nodal Displacement File path");
    p_displpath->setValue(init_path, "*");
    p_nshpath = addFileBrowserParam("nodal_result_path", "Nodal Results File path");
    p_nshpath->setValue(init_path, "*");
    p_elempath = addFileBrowserParam("element_result_path", "Element Results File path");
    p_elempath->setValue(init_path, "*");
    p_option = addChoiceParam("Option", "perNode od perElement data");
    p_option->setValue(2, ChoiseVal, 0);
    p_timesteps = addInt32Param("timesteps", "timesteps");
    p_timesteps->setValue(1);
    p_skip = addInt32Param("skipped_files", "number of skip files for each timestep");
    p_skip->setValue(0);
    p_columns = addInt32Param("nb_columns", "number of column in the result file");
    p_columns->setValue(1);

    //ports

    //p_inPort1->setRequired(0);
    p_outPort1 = addOutputPort("mesh", "UnstructuredGrid", "Mesh output");
    p_outPort2 = addOutputPort("data1", "Vec3", "Vector Data Field 1 output");
    p_outPort3 = addOutputPort("data2", "Float", "Scalar Data Field 1 output");
    p_outPort4 = addOutputPort("type", "IntArr", "IDs");
    //private data
    gridFile = NULL;
    grid_path = NULL;
    nsh_path = NULL;
    displ_path = NULL;
}
示例#8
0
/* constructor */
writeToCgns::writeToCgns(int argc, char *argv[])
:coModule(argc, argv, "writeToCgns") {
   //input ports
   p_inputPort_grid = addInputPort("in_grid", "UnstructuredGrid", "computational grid");  
   p_inputPort_boundaryElementFaces = addInputPort("boundary_element_faces","coDoSet","boundary element faces");
   //decide if ports are required and initialize
   p_inputPort_grid->setRequired(1);
   p_inputPort_boundaryElementFaces->setRequired(1);

   //specify filename of cgns file with browser
   cgns_filebrowser = addFileBrowserParam("path_to_file", "filename of cgns file");
   cgns_filebrowser->setValue(".", "*.cgns/*");
}
示例#9
0
ReadGromacs::ReadGromacs(int argc, char *argv[])
    : coModule(argc, argv, "Gromacs File Reader")
{
    // Output- Ports
    pointsOutput = addOutputPort("outPort", "Points", "Points output");
    elementout = addOutputPort("outP", "Int", "Ordnungszahl output");
    // pointsAnimationOutput = addOutputPort("outAnimation","Points","Animationoutput");

    // Parameters
    groFileParam = addFileBrowserParam("grofile", "Gromacs sturcture file");
    groFileParam->setValue("data/gromacs", "*.gro");

    // xtcFileParam=addFileBrowserParam("xtcfile","Gromacs tractory file");
    // xtcFileParam->setValue("data/gromacs","*.xtc");
}
示例#10
0
文件: ReadIBB.cpp 项目: nixz/covise
ReadIBB::ReadIBB(int argc, char *argv[])
    : coModule(argc, argv, "Read module for IBB GID files")
{

    char buf[300];

    //ports & parameters

    port_grid = addOutputPort("grid", "UnstructuredGrid", "computation grid");
    port_displacement = addOutputPort("displacements", "Vec3", "grid displacements");
    port_velocity = addOutputPort("velocity", "Vec3", "output velocity");
    port_pressure = addOutputPort("pressure", "Float", "output pressure");
    port_k = addOutputPort("k", "Float", "output k");
    port_eps = addOutputPort("eps", "Float", "output eps");
    //   port_boco = addOutputPort ("boco", "USR_FenflossBoco", "Boundary Conditions");
    port_pressrb = addOutputPort("press_rb", "Polygons", "pressure boundary conditions");
    port_wall = addOutputPort("wall", "Polygons", "wall elements");
    port_bila = addOutputPort("bila_elems", "Polygons", "marked elements");
    port_bcin = addOutputPort("bcin", "Polygons", "inlet elements");

    sprintf(buf, "%s/", getenv("HOME"));
    p_geoFile = addFileBrowserParam("geoFile", "Geometry File");
    p_geoFile->setValue(buf, "*.msh;*.MSH");

    p_simFile = addFileBrowserParam("simFile", "Geometry File");
    p_simFile->setValue(buf, "*.res*;*.RES*");

    p_firstStep = addInt32Param("firstStepNo", "first Step Nr.");
    p_firstStep->setValue(0);

    p_numt = addInt32Param("numt", "Number of Timesteps to read");
    p_numt->setValue(1000);

    p_skip = addInt32Param("skip", "Number of Timesteps to skip");
    p_skip->setValue(0);
}
示例#11
0
文件: ReadPLUTO.cpp 项目: nixz/covise
ReadPLUTO::ReadPLUTO(int argc, char **argv)
    : coSimpleModule(argc, argv,
                     "Read PLUTO")
{
    // ports
    p_mesh = addOutputPort("mesh", "StructuredGrid", "structured grid");
    p_rho = addOutputPort("rho", "Float", "density");
    p_rholog = addOutputPort("rholog", "Float", "logarithmic density");
    p_pressure = addOutputPort("pressure", "Float", "pressure");
    p_pressurelog = addOutputPort("pressurelog", "Float", "logarithmic pressure");
    p_velocity = addOutputPort("velocity", "Vec3", "velocity");
    p_magfield = addOutputPort("magfield", "Vec3", "magnetic field");
    p_velocity_cart = addOutputPort("velocity_cart", "Vec3", "velocity in cartesian coordinates");
    p_magfield_cart = addOutputPort("magfield_cart", "Vec3", "magnetic field in cartesian coordinates");

    // choice arrays
    const char *precisionChoice[] = { "single", "double" };
    const char *fileFormatChoice[] = { "single", "multiple" };

    // parameter
    p_path = addFileBrowserParam("path", "Data file path");
    p_path->setValue("$PLUTO_DIR/Torus_3D/", "grid.out");

    p_precision = addChoiceParam("format", "single or double precision");
    p_precision->setValue(2, precisionChoice, 0);

    p_file_format = addChoiceParam("single", "single file or multiple files");
    p_file_format->setValue(2, fileFormatChoice, 1);

    p_tbeg = addInt32Param("t_beg", "First timestep to read");
    p_tbeg->setValue(1);

    p_tend = addInt32Param("t_end", "Last timestep to read");
    p_tend->setValue(1);

    p_skip = addInt32Param("skip", "Number of timesteps to skip");
    p_skip->setValue(0);

    p_axisymm = addBooleanParam("axisymm", "Is the data spherical 2D axisammetric?");
    p_axisymm->setValue(0); // 0 == False

    p_n_axisymm = addInt32Param("n_axisymm", "Expand phi-coordinate with n cells");
    p_skip->setValue(20);

    mesh = NULL;
}
示例#12
0
/*! \brief constructor
 *
 * create In/Output Ports and module parameters here
 */
LoadCadData::LoadCadData(int argc, char **argv)
    : coModule(argc, argv, "Read CAD data")
{

    p_pointName = addOutputPort("model", "Points", "Model");
    p_modelPath = addFileBrowserParam("modelPath", "modelPath");
    p_scale = addFloatParam("scale", "global Scale factor used for OpenCover session");
    p_resize = addFloatVectorParam("resize", "Resize factor");
    p_rotangle = addFloatParam("rotangle", "angle for rotation");
    p_tansvec = addFloatVectorParam("transvec", "Vector for translation");
    p_rotvec = addFloatVectorParam("rotsvec", "Vector for rotation");
    p_backface = addBooleanParam("backface", "Backface Culling");
    p_orientation_iv = addBooleanParam("orientation_iv", "Orientation of iv models like in Inventor Renderer");
    p_convert_xforms_iv = addBooleanParam("convert_xforms_iv", "create LoadCadData DCS nodes");

    p_scale->setValue(-1.0);
    p_rotangle->setValue(0);
    p_resize->setValue(1, 1, 1);
}
示例#13
0
void ReadCadmould::createParam()
{
    // file browser parameter
    p_filename = addFileBrowserParam("filename", "file name of Fuellbild or .cfe file");
    p_filename->setValue("data/nofile", "?????;*.cfe");
    // p_filename->setValue("data/Kunden/faurecia/CADMOULD-Test/nofile","?????");//

    // 3 grid ports : stationary, transient, filling
    p_mesh = addOutputPort("stMesh", "UnstructuredGrid", "stationary mesh");
    p_stepMesh = addOutputPort("trMesh", "UnstructuredGrid", "transient mesh");
    p_thick = addOutputPort("thick", "Float", "thickness of elements");

    // the output ports and choices
    // Loop for data fields: choices and ports
    char name[32];
    const char *defaultChoice[] = { "---" };
    for (int i = 0; i < NUM_PORTS; i++)
    {
        sprintf(name, "Choice_%d", i);
        p_choice[i] = addChoiceParam(name, "Select data for port");
        p_choice[i]->setValue(1, defaultChoice, 0);

        sprintf(name, "Data_%d", i);
        p_data[i] = addOutputPort(name, "Float|IntArr", name);
    }

    p_no_time_steps = addInt32Param("fillTimeStep", "time steps for filling");
    p_no_time_steps->setValue(25);

    const char *defaultFill[] = { "automatic" };
    p_fillField = addChoiceParam("fillField", "Select field for filling");
    p_fillField->setValue(1, defaultFill, 0);

    p_no_data_color = addStringParam("noDataColor", "RGBA color for non-filled elements");

    p_no_data_color->setValue("0xd0d0d0ff");

    //   p_byteswap = addBooleanParam("byteSwapping","byte_swapping");
    p_fillMesh = addOutputPort("fiMesh", "UnstructuredGrid", "mesh for filling");
    p_fillData = addOutputPort("fiValuw", "Float", "data for filling");
}
示例#14
0
ReadITT::ReadITT(int argc, char *argv[])
    : coSimLib(argc, argv, "ReadITT", "This is the ReadITT module transformed into interface to simulation")
{
    // module parameters
    char *pDataPath = getenv("COVISE_DATA_ITT");

    m_pParamFile = addFileBrowserParam("Filename", "dummy");
    if (pDataPath != NULL)
    {
        m_pParamFile->setValue(pDataPath, "*.via;*.vim;*.vis/*.via/*.vim/*.vis/*");
    }
    else
    {
        m_pParamFile->setValue("./", "*.via;*.vim;*.vis/*.via/*.vim/*.vis/*");
    }

    m_pLookAhead = addBooleanParam("Lookahead", "lookahead");
    m_pLookAhead->setValue(0);

    m_pLookAheadValue = addInt32Param("LookaheadValue", "test");
    m_pLookAheadValue->setValue(0);

    m_pSleepSeconds = addInt32Param("SleepSeconds", "seconds to sleep");
    m_pSleepSeconds->setValue(10);

    // Output ports
    m_portPoints = addOutputPort("points", "Points", "points Output");
    m_portPoints->setInfo("points Output");

    m_portRadii = addOutputPort("radii", "Float", "Atom Radii Output");
    m_portRadii->setInfo("Radii Output");

    m_portColors = addOutputPort("colors", "RGBA", "Atom Colors Output");
    m_portColors->setInfo("Colors Output");

    m_portVolumeBox = addOutputPort("Boundingbox", "Lines", "Bounding Box Output");
    m_portVolumeBox->setInfo("BoundingBox Output");

    m_bDoSelfExec = false;
}
示例#15
0
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++
// ++++  Constructor : This will set up module port structure
// ++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CoolEmAllToDatabase::CoolEmAllToDatabase(int argc, char *argv[])
    : coModule(argc, argv, "CoolEmAllToDatabase, world! program")
{
    // no parameters, no ports...
    p_grid = addInputPort("grid", "UnstructuredGrid", "Distributed Grid");
    p_boco = addInputPort("boco", "USR_FenflossBoco", "Boundary Conditions");
    p_temp = addInputPort("temp", "Float", "Temperature Values");
    p_p = addInputPort("pressure", "Float", "Pressure Values");
    p_velo = addInputPort("velocities", "Vec3", "Velocity Values");
    p_gridOut = addOutputPort("gridout", "UnstructuredGrid", "the computational mesh");

    p_databasePrefix = addStringParam("databasePrefix", "databasePrefix");
    p_databasePrefix->setValue("none");
    p_csvPath = addFileBrowserParam("csvPath", "path to csv file");
    p_csvPath->setValue("/tmp/CoolEmAll.csv", "*.csv");

    p_grid->setRequired(1);
    p_boco->setRequired(1);
    p_temp->setRequired(0);
    p_p->setRequired(0);
    p_velo->setRequired(0);
}
示例#16
0
rechenraum::rechenraum(int argc, char *argv[])
    : coModule(argc, argv, "rechenraum")
{
    geo = NULL;

//   fprintf(stderr, "rechenraum::rechenraum()\n");

#ifdef USE_STARTFILE
    // start file param

    //   fprintf(stderr, "rechenraum::rechenraum() Init of StartFile\n");
    startFile = addFileBrowserParam("startFile", "Start file");
    startFile->setValue(coCoviseConfig::getEntry("value", "Module.Rechenraum.DataPath", getenv("HOME")), "*.txt");
#endif

    // We build the User-Menue ...
    rechenraum::CreateUserMenu();

    // the output ports
    //   fprintf(stderr, "rechenraum::rechenraum() SetOutPort\n");
    grid = addOutputPort("grid", "UnstructuredGrid", "Computation Grid");
    surface = addOutputPort("surface", "Polygons", "Surface Polygons");
    bcin = addOutputPort("bcin", "Polygons", "Cells at entry");
    bcout = addOutputPort("bcout", "Polygons", "Cells at exit");
    bcwall = addOutputPort("bcwall", "Polygons", "Cells at walls");
    boco = addOutputPort("boco", "USR_FenflossBoco", "Boundary Conditions");
    intypes = addOutputPort("inletbctype", "Float", "0: cluster, 1-n: floor square type");
    bccheck = addOutputPort("bccheck", "Polygons", "can be used to check bc polygons");

    inpoints = addOutputPort("InbcNodes", "Points", "inbc nodes");
    feedback_info = addOutputPort("FeedbackInfo", "Points", "Feedback Info");

    model = NULL;
    rg = NULL;

    isInitialized = 0;
}
示例#17
0
文件: ReadSTP3.cpp 项目: nixz/covise
/// Constructor
coReadSTP3::coReadSTP3(int argc, char *argv[])
    : coModule(argc, argv, "Read STP3 volume files.")
{
    // Create ports:
    poGrid = addOutputPort("grid", "UniformGrid", "Grid for volume data");
    poGrid->setInfo("Grid for volume data");

    poVolume = addOutputPort("data", "Float", "Scalar volume data");
    poVolume->setInfo("Scalar volume data (range 0-1)");

    // Create parameters:
    pbrVolumeFile = addFileBrowserParam("FilePath", "STP3 file");
    pbrVolumeFile->setValue("data", "*.img");

    pboUseVoi = addBooleanParam("UseVoi", "Map data outside of volume of interest to constant value");
    pboUseVoi->setValue(false);

    pisVoiNo = addInt32Param("NoVoi", "Number of volume of interest to use");
    pisVoiNo->setValue(1);

    pfsIgnoreValue = addFloatParam("IgnoreValue", "Value data not within the volume of interest is mapped to");
    pfsIgnoreValue->setValue(0.0);

    for (int i = 0; i < NO_VOIS; i++)
    {
        char buf1[1024], buf2[1024];
        sprintf(buf1, "Volume%dFromVoi", i + 1);
        sprintf(buf2, "Number of volume of interest to use for volume %d", i + 1);
        pisVolumeFromVoi[i] = addInt32Param(buf1, buf2);
        pisVolumeFromVoi[i]->setValue(i + 2);

        sprintf(buf1, "voi%d", i + 1);
        sprintf(buf2, "Volume of interest no. %d", i + 1);
        poVoi[i] = addOutputPort(buf1, "Float", buf2);
    }
}
示例#18
0
文件: ParamTest.cpp 项目: nixz/covise
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++
// ++++  Constructor : This will set up module port structure
/// ++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ParamTest::ParamTest(int argc, char *argv[])
    : coSimpleModule(argc, argv, "Param Program: Show all parameter types")
{
    //autoInitParam(0);

    // Immediate-mode String parameter
    stringImm = addStringParam("stringImm", "Immediate string");
    stringImm->setValue("This is an immediate String Parameter");

    // Immediate-mode Boolean parameter, pre-set to FALSE
    boolImm = addBooleanParam("boolImm", "Immediate coBooleanParam");
    boolImm->setValue(0);

    iScalImm = addInt32Param("iScalImm", "Immediate coIntScalarParam");
    iScalImm->setValue(123);

    fScalImm = addFloatParam("fScalImm", "Immediate coFloatParam");
    fScalImm->setValue(-12.56f);

    // integer sliders: immediate and non-immediate
    iSlidImm = addIntSliderParam("iSlidImm", "Immediate coIntSliderParam");
    iSlidImm->setValue(1, 27, 16);

    // float sliders: immediate and non-immediate
    fSlidImm = addFloatSliderParam("fSlidImm", "Immediate coFloatSliderParam");
    fSlidImm->setValue(-10.0, 30.0, 0.0);

    // float vector: use default size of 3 and set with 3D setValue function
    fVectImm = addFloatVectorParam("fVectImm", "Immediate coFloatVectorParam");
    fVectImm->setValue(1.34f, 1.889f, -99.87f);

    // it makes no sense to put a file selector in the switch, since
    // it is not displayed in the control panel
    browseImm = addFileBrowserParam("myFile", "a file browser");
    browseImm->setValue("/var/tmp/whatever.txt", "*.txt");
    browseImm->show();

    browse = addFileBrowserParam("my2File", "a file browser");
    browse->setValue("/var/tmp/whatever2.txt", "*.txt");
    browse->show();

    // Now this is a choice : we have the choice between 6 values
    const char *choiceVal[] = {
        "left lower inlet", "left upper inlet",
        "left center inlet", "right center inlet",
        "right lower Inlet", "right upper Inlet"
    };
    choImm = addChoiceParam("choImm", "Nun auch noch Choices");
    choImm->setValue(6, choiceVal, 1);

    // add an input port for 'coDoUnstructuredGrid' objects
    inPortReq = addInputPort("inputReq", "StructuredGrid", "Required input port");

    // add another input port for 'coDoUnstructuredGrid' objects
    inPortNoReq = addInputPort("inputNoReq", "UnstructuredGrid", "Not required input port");

    // tell that this port does not have to be connected
    inPortNoReq->setRequired(0);

    // add an output port for this type
    outPort = addOutputPort("outPort", "coDoUnstructuredGrid", "Output Port");

    // and that's all ... no init() or anything else ... that's done in the lib
}
示例#19
0
ReadMPAPDB::ReadMPAPDB(int argc, char *argv[])
    : coModule(argc, argv, "Reader for MPA PDB files")
{

    m_pParamFile = addFileBrowserParam("filename", "name of first PDB file to read");
    m_pParamFile->setValue("", "*.pdb;*.rasmol/*");

    m_pUseIDFromFile = addBooleanParam("use_ID_from_file", "use atom ID from file (otherwise use atom name)");
    m_pUseIDFromFile->setValue(true);

    m_pNTimesteps = addInt32Param("n_timesteps", "number of timesteps to read");
    m_pNTimesteps->setValue(1);

    m_pStepTimesteps = addInt32Param("Step_timesteps", "read every n-th timestep (Step)");
    m_pStepTimesteps->setValue(1);

    m_portPoints = addOutputPort("points", "Points", "points Output");
    m_portPoints->setInfo("points Output");

    m_portAtomType = addOutputPort("AtomType", "Int", "atom type");
    m_portAtomType->setInfo("Atom type");

    m_portAtomID = addOutputPort("AtomID", "Int", "ID of each atom");
    m_portAtomID->setInfo("Atom ID");

    // try to add local atommapping.xml to current coviseconfig
    m_mapConfig = new coConfigGroup("Module.AtomColors");
    m_mapConfig->addConfig(coConfigDefaultPaths::getDefaultLocalConfigFilePath() + "atommapping.xml", "local", true);
    coConfig::getInstance()->addConfig(m_mapConfig);

    coCoviseConfig::ScopeEntries mappingEntries = coCoviseConfig::getScopeEntries("Module.AtomMapping");
    if (mappingEntries.getValue() == NULL)
    {
        // add global atommapping.xml to current coviseconfig
        m_mapConfig->addConfig(coConfigDefaultPaths::getDefaultGlobalConfigFilePath() + "atommapping.xml", "global", true);
        coConfig::getInstance()->addConfig(m_mapConfig);
        // retrieve the values of atommapping.xml and build the GUI
    }
    coCoviseConfig::ScopeEntries mappingEntries2 = coCoviseConfig::getScopeEntries("Module.AtomMapping");

    const char **mapEntry = mappingEntries2.getValue();
    if (mapEntry == NULL)
        std::cout << "AtomMapping is NULL" << std::endl;
    int iNrCurrent = 0;
    float radius;
    char cAtomName[256];
    char cAtomType[TYPELENGTH];

    if (mapEntry == NULL || *mapEntry == NULL)
        std::cout << "The scope Module.AtomMapping is not available in your covise.config file!" << std::endl;

    const char **curEntry = mapEntry;
    while (curEntry && *curEntry)
    {
        AtomColor ac;
        int iScanResult = sscanf(curEntry[1], "%3s %s %f %f %f %f %f", cAtomType, cAtomName, &radius, &ac.color[0], &ac.color[1], &ac.color[2], &ac.color[3]);

        if (iScanResult == 7)
        {
            m_rgb.push_back(ac);
            if (radius < 0.)
                radius = 0.;
            m_radius.push_back(radius);
            m_atomtype.push_back(ac.type);

            // convert to lower case (we want to be case-insensitive)
            for (int i = 0; i < TYPELENGTH; i++)
            {
                cAtomType[i] = tolower(cAtomType[i]);
            }
            AtomID[cAtomType] = iNrCurrent;

            //fprintf(stderr, "%d: name=%s (%s)\n", iNrCurrent+1, cAtomName, ac.type);
            if (iNrCurrent + 1 != atoi(curEntry[0]))
            {
                std::cout << "Your atommapping.xml is garbled" << std::endl;
            }
        }
        iNrCurrent++;
        curEntry += 2;
    }
}
示例#20
0
void StarCD::createParam()
{
    char buf[MAXPATHLEN];
    /// ----- create all common parameter ports

    /// --- create all output ports
    createOutPorts();

    // give the file for the grid -> we'll need some more info from file 16
    // create a valid starting directory
    p_setup = addFileBrowserParam("setup", "Setup file");

    // the user may have a StarCD config dir
    const char *starconfig = getenv("STARCONFIG");
    if (starconfig)
    {
        strcpy(buf, starconfig);
        strcat(buf, "/dummy");
    }
    else
    {
        const char *covisedir = getenv("COVISEDIR");
        if (covisedir)
        {
            strcpy(buf, covisedir);
            strcat(buf, "/data/dummy");
        }
        else
            strcpy(buf, "./dummy");
    }

    p_setup->setValue(buf, "*.starconfig");

    /// the number of steps to go
    p_steps = addInt32Param("step", "Number of steps to go");
    p_steps->setValue(1);

    /// the boolean parameter decides if the simulation should re-exec
    p_freeRun = addBooleanParam("freeRun", "Execute again automagically");
    p_freeRun->setValue(0);

    /// the boolean parameter decides if the simulation should re-exec
    p_runSim = addBooleanParam("run_Simulation", "Simulation running now");
    p_runSim->setValue(0);

    /// the boolean parameter decides if the simulation should re-exec
    p_quitSim = addBooleanParam("quit_Simulation", "shut down simulation");
    p_quitSim->setValue(0);

    /// the number processors to use
    p_numProc = addInt32Param("numProc", "Number of Processors to use");
    p_numProc->setValue(4);

    /// --- create region parameter ports
    createRegionParam();

    /// --- we don't need input here: if we get anything, we set up a new case
    p_configObj = addInputPort("configObj", "Text",
                               "Configuration lines replace starconfig file");
    p_configObj->setRequired(0);

    /// --- we don't need input here: if we get anything, add it to script params
    p_commObj = addInputPort("scriptPara", "Text",
                             "Additional parameters for startup script");
    p_commObj->setRequired(0);
}