示例#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
文件: 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);
}
示例#3
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;
}
示例#4
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;
}
示例#5
0
文件: TestLic.cpp 项目: nixz/covise
Lic::Lic()
{
    // this info appears in the module setup window
    set_module_description("LIC testing device");

    //parameters
    //resolution = addInt32Param("Resolution", "resolution");
    pixImgWidth = addInt32Param("Width", "width of pixel image");
    pixImgHeight = addInt32Param("Height", "height of pixel image");
    pixelSize = addInt32Param("Pixel Size", "bytes per pixel");
    //domainSize = addFloatParam("Domain Size", "size");
    scaleQuad = addFloatParam("Scale Quad", "quad size");

    //const int defaultDim = 2;
    //resolution->setValue(defaultDim);

    const int defaultWidth = 8;
    pixImgWidth->setValue(defaultWidth);

    const int defaultHeight = 8;
    pixImgHeight->setValue(defaultHeight);

    const int defaultPixelSize = 4;
    pixelSize->setValue(defaultPixelSize);

    //const float defaultSize = 1.0;
    //domainSize->setValue(defaultSize);

    const float defaultSQ = 1.1;
    scaleQuad->setValue(defaultSQ);

    // the input ports
    polygonInPort = addInputPort("polygonIn", "coDoPolygons", "Polygons");
    //vectorInPort = addInputPort("vectorIn","coDoVec3",\ 
   "Vector Data");

    // the output ports
    polygonOutPort = addOutputPort("polygonOut", "coDoPolygons", "Polygons");
    packageOutPort = addOutputPort("packageOut", "coDoPolygons", "2D Triangle Patch");
    textureOutPort = addOutputPort("textureOut", "coDoTexture", "Lic Texture");
}
示例#6
0
ComputeTrace::ComputeTrace(int argc, char *argv[])
    : coSimpleModule(argc, argv, "Creates traces from points timestep dependent")
    , m_firsttime(true)
{
    //the timesteps shall NOT be handled automatically by the coSimpleModule class
    setComputeTimesteps(1);

    /*Fed in points*/
    p_pointsIn = addInputPort("GridIn0", "Points|Spheres", "a set of points or spheres containing the particle/s to be traced over time");
    p_dataIn = addInputPort("DataIn0", "Float|Byte|Int|Vec2|Vec3|RGBA|Mat3|Tensor", "data mapped associated with spheres");
    p_dataIn->setRequired(false);
    p_IDIn = addInputPort("IDIn0", "Int", "ID of each atom");
    p_IDIn->setRequired(false);
    /*Boolean that specifies if a particle should be traced or not*/
    p_traceParticle = addBooleanParam("traceParticle", "set if particle should be traced");
    p_traceParticle->setValue(1);
    /*Integer that specifies the particle to be traced in Module Parameter window*/
    p_particle = addStringParam("selection", "ranges of selected set elements");
    p_particle->setValue("1-1");
    p_maxParticleNumber = addInt32Param("maxParticleNum", "maximum number of particles to trace");
    p_maxParticleNumber->setValue(100);
    /*Integer that specifies the starting point*/
    p_start = addIntSliderParam("start", "Timestep at which the tracing should be started");
    p_start->setValue(0, 0, 0);
    /*Integer that specifies the ending point*/
    p_stop = addIntSliderParam("stop", "Timestep at which the tracing should be stopped");
    p_stop->setValue(0, 0, 0);
    /* Boolean that specifies if the bounding box leaving should be regarded */
    p_regardInterrupt = addBooleanParam("LeavingBoundingBox", "set if leaving bounding box should be taken into account");
    p_regardInterrupt->setValue(0);
    p_animate = addBooleanParam("animate", "disable for static trace");
    p_animate->setValue(1);
    /* 3 values specifying the x, y and z dimension of the bounding box */
    p_boundingBoxDimensions = addFloatVectorParam("BoundingBoxDimensions", "x, y, z dimensions of the bounding box");
    p_boundingBoxDimensions->setValue(0, 0, 0);
    /*Output should be a line*/
    p_traceOut = addOutputPort("GridOut0", "Lines", "Trace of a specified particle");
    /*unique index per line mappable as color attribute*/
    p_indexOut = addOutputPort("DataOut0", "Float", "unique index for every specified particle");
    /*fade out value per timestep mappable as color attribute*/
    p_fadingOut = addOutputPort("DataOut1", "Float", "fade out value for per vertex coloring of lines over time");
    p_dataOut = addOutputPort("DataOut2", "Float|Byte|Int|Vec2|Vec3|RGBA|Mat3|Tensor", "data mapped to lines");

    p_dataOut->setDependencyPort(p_dataIn);
    IDs = NULL;

    assert(sizeof(animValues) / sizeof(animValues[0]) == AnimNumValues);
    p_animateViewer = addChoiceParam("animateViewer", "Animate Viewer");
    p_animateViewer->setValue(AnimNumValues, animValues, AnimOff);

    p_animLookAt = addFloatVectorParam("animLookAt", "Animated viewer looks at this point");
    p_animLookAt->setValue(0., 0., 0.);
}
示例#7
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;
}
示例#8
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;
}
示例#9
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);
}
示例#10
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);
    }
}
示例#11
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");
}
示例#12
0
MakeOctTree::MakeOctTree(int argc, char *argv[])
    : coSimpleModule(argc, argv, "Create Octrees for UNSGRDs")
{
    p_grids_ = addInputPort("inGrid", "UnstructuredGrid|Polygons", "input grid");
    p_octtrees_ = addOutputPort("outOctTree", "OctTree|OctTreeP", "output octtree");
    p_normal_size_ = addInt32Param("normal_size", "normal size of octree population");
    p_normal_size_->setValue(coDoBasisTree::NORMAL_SIZE);
    p_max_no_levels_ = addInt32Param("max_no_levels", "Maximum number of levels in an octree");
    p_max_no_levels_->setValue(coDoBasisTree::MAX_NO_LEVELS);
    p_min_small_enough_ = addInt32Param("min_small_enough", "(minimum) normal size of leaf population");
    p_min_small_enough_->setValue(coDoBasisTree::MIN_SMALL_ENOUGH);
    p_crit_level_ = addInt32Param("crit_level", "critical level for population control");
    p_crit_level_->setValue(coDoBasisTree::CRIT_LEVEL);
    p_limit_fX_ = addInt32Param("limit_fX", "limit number of division in the X direction");
    p_limit_fX_->setValue(INT_MAX);
    p_limit_fY_ = addInt32Param("limit_fY", "limit number of division in the Y direction");
    p_limit_fY_->setValue(INT_MAX);
    p_limit_fZ_ = addInt32Param("limit_fZ", "limit number of division in the Z direction");
    p_limit_fZ_->setValue(INT_MAX);
}
示例#13
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
}
示例#14
0
文件: Sample.cpp 项目: nixz/covise
Sample::Sample(int argc, char *argv[])
    : coModule(argc, argv, "Sample data on points, unstructured and uniform grids to a uniform grid")
{

    const char *outsideChoice[] = { "MAX_FLT", "user_defined_fill_value" };
    const char *sizeChoice[] = { "user defined", "8", "16", "32", "64", "128", "256", "512", "1024" };
    const char *algorithmChoices[] = {
        "possible holes",
        "no holes and no expansion",
        "no holes and expansion",
        "accurate and slow"
        /*, "number weights" */
    };
    const char *bounding_boxChoices[] = { "automatic per timestep", "automatic global", "manual" };

    const char *pointSamplingChoices[] = { "linear", "logarithmic", "normalized linear", "normalized logarithmic" };

    // fill value for outside
    outsideChoiceParam = addChoiceParam("outside", "fill value for outside - MAXFLT or number");
    outsideChoiceParam->setValue(2, outsideChoice, 0);

    fillValueParam = addFloatParam("fill_value", "Fill Value if not intersecting");
    fillValueParam->setValue(0.0);

    // choose algorithm
    p_algorithm = addChoiceParam("algorithm", "choose algorithm");
    p_algorithm->setValue(4, algorithmChoices, 2);

    // choose mapping for point sampling
    p_pointSampling = addChoiceParam("point_sampling", "choose mapping for point sampling");
    p_pointSampling->setValue(4, pointSamplingChoices, 2);

    // select dimension in i direction
    iSizeChoiceParam = addChoiceParam("isize", "unigrid size in i direction");
    iSizeChoiceParam->setValue(9, sizeChoice, 3);

    iSizeParam = addInt32Param("user_defined_isize", "user defined i_size");
    iSizeParam->setValue(32);

    jSizeChoiceParam = addChoiceParam("jsize", "unigrid size in j direction");
    jSizeChoiceParam->setValue(9, sizeChoice, 3);

    jSizeParam = addInt32Param("user_defined_jsize", "user defined j_size");
    jSizeParam->setValue(32);

    kSizeChoiceParam = addChoiceParam("ksize", "unigrid size in k direction");
    kSizeChoiceParam->setValue(9, sizeChoice, 3);

    kSizeParam = addInt32Param("user_defined_ksize", "user defined k_size");
    kSizeParam->setValue(32);

    p_bounding_box = addChoiceParam("bounding_box", "bounding box calculation");
    p_bounding_box->setValue(3, bounding_boxChoices, 0); // default to manual

    float boundsIni[3] = { -1.0, -1.0, -1.0 };
    p_P1bound_manual = addFloatVectorParam("P1_bounds", "First point");
    p_P1bound_manual->setValue(3, boundsIni);

    float boundsEnd[3] = { 1.0, 1.0, 1.0 };
    p_P2bound_manual = addFloatVectorParam("P2_bounds", "Second point");
    p_P2bound_manual->setValue(3, boundsEnd);

    // eps to cover numerical problems
    epsParam = addFloatParam("eps", "small value to cover numerical problems");
    epsParam->setValue(0.0);

    // add an input port for 'coDoUnstructuredGrid' objects
    Grid_In_Port = addInputPort("GridIn", "UnstructuredGrid|UniformGrid|RectilinearGrid|StructuredGrid|Points", "Grid input");
    Data_In_Port = addInputPort("DataIn", "Float|Vec3", "Data input");
    Data_In_Port->setRequired(0);
    Reference_Grid_In_Port = addInputPort("ReferenceGridIn", "UniformGrid", "Reference Grid");
    Reference_Grid_In_Port->setRequired(0);

    // add an output port for this type
    Grid_Out_Port = addOutputPort("GridOut", "UniformGrid", "Grid Output Port");
    Data_Out_Port = addOutputPort("DataOut", "Float|Vec3", "Data Output Port");
}
示例#15
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;
    }
}
示例#16
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);
}
示例#17
0
void rechenraum::CreateUserMenu(void)
{
    //   fprintf(stderr, "Entering CreateUserMenu()\n");

    char *tmp;
    int i;
    char path[512];

    p_makeGrid = addBooleanParam("make_grid", "make grid?");
    p_makeGrid->setValue(0);

    p_lockmakeGrid = addBooleanParam("lock_make_grid_button", "lock make grid button?");
    p_lockmakeGrid->setValue(0);

    p_createGeoRbFile = addBooleanParam("create_geo_or_rb_file", "create geo/rb file?");
    p_createGeoRbFile->setValue(0);

    p_gridSpacing = addFloatParam("spacing", "elements per floor square");
    p_gridSpacing->setValue(4.);

    p_model_size = addFloatVectorParam("model_size", "model size");
    p_model_size->setValue(36.54, 22.54, 3.20);

    p_nobjects = addInt32Param("n_objects", "make grid?");
    p_nobjects->setValue(MAX_CUBES);

    p_Q_total = addFloatParam("Q_inlet_m3_h", "total flow rate in m3/h");
    p_Q_total->setValue(320000.);

    p_v_SX9 = addFloatParam("v_SX9", "flow velocity at SX9 inlet and outlet in m/s");
    p_v_SX9->setValue(0.84);

    sprintf(path, "%s/racks.txt", coCoviseConfig::getEntry("value", "Module.Rechenraum.GeorbPath", "/data/rechenraum").c_str());
    p_BCFile = addStringParam("BCFile", "BCFile");
    p_BCFile->setValue(path);

    sprintf(path, "%s/geofile.geo", coCoviseConfig::getEntry("value", "Module.Rechenraum.GeorbPath", "/data/rechenraum").c_str());
    p_geofile = addStringParam("GeofilePath", "geofile path");
    p_geofile->setValue(path);

    sprintf(path, "%s/rbfile.geo", coCoviseConfig::getEntry("value", "Module.Rechenraum.GeorbPath", "/data/rechenraum").c_str());
    p_rbfile = addStringParam("RbfilePath", "rbfile path");
    p_rbfile->setValue(path);

    m_Geometry = paraSwitch("Geometry", "Select Rack");
    geo_labels = (char **)calloc(MAX_CUBES, sizeof(char *));

    for (i = 0; i < MAX_CUBES; i++)
    {
        // create description and name
        geo_labels[i] = IndexedParameterName(GEO_SEC, i);
        paraCase(geo_labels[i]); // Geometry section

        tmp = IndexedParameterName("pos_rack", i);
        p_cubes_pos[i] = addFloatVectorParam(tmp, tmp);
        p_cubes_pos[i]->setValue(0.0, 0.0, 0.0);

        tmp = IndexedParameterName("size_rack", i);
        p_cubes_size[i] = addFloatVectorParam(tmp, tmp);
        p_cubes_size[i]->setValue(0.0, 0.0, 0.0);
        free(tmp);

        paraEndCase(); // Geometry section
    }
    paraEndSwitch(); // "GeCross section", "Select GeCross section"

    m_FlowRate = paraSwitch("FlowRate", "Select Rack");
    flow_labels = (char **)calloc(MAX_CUBES - 1, sizeof(char *)); // racks without escalator and cold house

    float flowrate_racks[MAX_CUBES - 4] = {
        5., //  0 Infrastruktur
        5., //  1 Phoenix
        4., //  2 NAS
        3., //  3 DDN
        3., //  4 Strider
        5., //  5 Blech
        5., //  6 Sx8R
        5., //  7 IBM_BW_Grid
        5., //  8 Disk_Rack_1 (5 Stueck)
        5., //  9 Disk_Rack_2 (5 Stueck)
        5., // 10 Disk_Rack_3 (5 Stueck)
        5., // 11 Disk_Rack_4 (5 Stueck)
        5., // 12 Disk_Rack_5 (4 Stueck)
        5., // 13 Netz1
        5., // 14 Disk_Rack_6 (5 Stueck)
        5., // 15 IOX
        5., // 16 Netz2
        5., // 17 FC_Netz
        5., // 18 Asama
        5., // 19 Disk_Rack_7 (4 Stueck)
        5., // 20 SX9
        5., // 21 Neu1
        5. // 22 Neu2
    };

    for (i = 0; i < MAX_CUBES - 4; i++)
    {
        // create description and name
        flow_labels[i] = IndexedParameterName(FLOW_SEC, i);
        paraCase(flow_labels[i]);

        tmp = IndexedParameterName("flowrate_rack", i);
        p_flowrate[i] = addFloatParam(tmp, tmp);
        p_flowrate[i]->setValue(flowrate_racks[i]);

        paraEndCase(); // FlowRate section
    }

    paraEndSwitch(); // Flowrate section

#ifndef USE_STARTFILE
    setGeoParamsStandardForRechenRaum();
#endif
}