void ModifyAddPart::createVentParam() { int i, j, k; p_vent = paraSwitch("Vent", "Select a vent"); for (i = 0; i < MAX_VENTS; i++) { // create description and name sprintf(buf, "Vent %d", i); // case for the vent switching paraCase(buf); sprintf(buf, "Vent_%d:Name", i); currVentFile[i] = 0; p_name[i] = addChoiceParam(buf, "Select a vent type substructure"); p_name[i]->setValue(numVentDirs, ventdirs, currVentFile[i]); sprintf(buf, "Vent_%d:Pos", i); p_pos[i] = addFloatVectorParam(buf, "Position"); p_pos[i]->setImmediate(1); p_pos[i]->setValue(0.0, 0.0, 0.0); pos[i][0] = pos[i][1] = pos[i][2] = 0.0; sprintf(buf, "Vent_%d:Euler", i); p_euler[i] = addFloatVectorParam(buf, "Euler Angles"); p_euler[i]->setImmediate(1); p_euler[i]->setValue(0.0, 0.0, 0.0); euler[i][0] = euler[i][1] = euler[i][2] = 0.0; sprintf(buf, "Vent_%d:Rot", i); p_rot[i] = addFloatVectorParam(buf, "Rotation Matrix"); p_rot[i]->setImmediate(1); for (j = 0; j < 3; j++) { for (k = 0; k < 3; k++) { if (j == k) coverRot[i][3 * k + j] = 1.0; else coverRot[i][3 * k + j] = 0; } } p_rot[i]->setValue(9, coverRot[i]); axis[i][0] = 1; axis[i][1] = 0; axis[i][2] = 0; /// vent case ends here paraEndCase(); } paraEndSwitch(); }
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.); }
Cube::Cube(int argc, char *argv[]) // vvvv --- this info appears in the module setup window : coModule(argc, argv, "Simple Cube Generation Module") { // output port // parameters: // port name // string to indicate connections, convention: name of the data type // description p_polyOut = addOutputPort("polygons", "Polygons", "polygons which form the cubes"); // input parameters // parameters: // parameter name // parameter type // description p_center = addFloatVectorParam("center", "Center of the cube"); cx = cy = cz = 0.0; p_center->setValue(cx, cy, cz); p_cusize = addFloatSliderParam("size", "Size of the cube"); sMin = 1.0; sMax = 100.0; sVal = 10.0; p_cusize->setValue(sMin, sMax, sVal); }
/*! \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); }
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++ // ++++ Constructor : This will set up module port structure // ++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Collect::Collect(int argc, char *argv[]) : coModule(argc, argv, "Combine grid, normals, colors, textures and vertex " "attributes in one data object for rendering") { // Parameters // Ports p_grid = addInputPort("GridIn0", "StructuredGrid|UnstructuredGrid|" "RectilinearGrid|UniformGrid|Points|Spheres" "|Lines|Polygons|Quads|Triangles|TriangleStrips", "Grid"); p_color = addInputPort("DataIn0", "Byte|Float|Vec3|RGBA", "Colors or Scalar Data for Volume Visualization"); p_color->setRequired(0); p_norm = addInputPort("DataIn1", "Vec3", "Normals"); p_norm->setRequired(0); p_text = addInputPort("TextureIn0", "Texture", "Textures"); p_text->setRequired(0); p_vertex = addInputPort("VertexAttribIn0", "Vec3|Float", "Vertex Attribute 0"); p_vertex->setRequired(0); p_outPort = addOutputPort("GeometryOut0", "Geometry", "combined object"); #ifdef MATERIAL p_material = addMaterialParam("Material", "Material definition for Renderer"); #endif p_varName = addStringParam("varName", "name of variant"); p_varName->setValue(""); p_attribute = addStringParam("attribute", "attributes in the form name=value;name2=value2;..."); p_attribute->setValue(""); p_boundsMinParam = addFloatVectorParam("minBound", "minimum bound"); p_boundsMinParam->setValue(0., 0., 0.); p_boundsMaxParam = addFloatVectorParam("maxBound", "maximum bound"); p_boundsMaxParam->setValue(0., 0., 0.); }
TestSlider::TestSlider(int argc, char *argv[]) : coModule(argc, argv, "Simple TestSlider Generation Module") { p_polyOut = addOutputPort("polygons", "Polygons", "polygons which form the cubes"); p_center = addFloatVectorParam("center", "Center of the cube"); cx = cy = cz = 0.0; p_center->setValue(cx, cy, cz); p_cusize = addFloatSliderParam("size", "Size of the cube"); sMin = 1.0; sMax = 10.0; sVal = 2.0; p_cusize->setValue(sMin, sMax, sVal); }
/// constructor coColorDistance::coColorDistance(int argc, char *argv[]) : coSimpleModule(argc, argv, "Compute distance to reference color") { // Create ports: piR = addInputPort("Red", "Float", "Scalar volume data (red channel)"); piR->setInfo("Scalar volume data (red channel)"); piG = addInputPort("Green", "Float", "Scalar volume data (green channel)"); piG->setInfo("Scalar volume data (green channel)"); piB = addInputPort("Blue", "Float", "Scalar volume data (blue channel)"); piB->setInfo("Scalar volume data (blue channel)"); poVolume = addOutputPort("Data", "Float", "Scalar volume data"); poVolume->setInfo("Scalar volume data (range 0-1)"); // Create parameters: paReferenceColor = addColorParam("ReferenceColor", "Color to which the distance is calculated"); paReferenceColor->setValue(0.0, 0.0, 0.0, 1); const char *cs[] = { "RGB", "HSV", "Hue-Saturation", "Hue" }; paColorSpace = addChoiceParam("ColorSpace", "Color space used for distance calculation"); paColorSpace->setValue(3, cs, 0); const char *metric[] = { "euclidian distance", "manhattan distance", "maximum" }; paMetric = addChoiceParam("Metric", "Metric for calculation of the distance for transparent values."); paMetric->setValue(3, metric, 0); paMinMax = addFloatVectorParam("MinMax", "Allowed range of distance.", 2); paMinMax->setValue(0, 0.); paMinMax->setValue(1, 1.); paSlider = addFloatSliderParam("DistanceBase", "This value is added to the calculated distance."); paSlider->setValue(-10, 10, 1); paSlider2 = addFloatSliderParam("DistanceMultiplier", "This value multiplies the calculated distance."); paSlider2->setValue(-10, 10, -1); }
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 }
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++ // ++++ 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 }
void StarCD::createRegionParam() { int i; char buf[32]; p_region = paraSwitch("region", "Select inlet region"); for (i = 0; i < MAX_REGIONS; i++) { // create description and name sprintf(buf, "Region %d", i); // case for the Region switching paraCase(buf); // the 'usual parameters sprintf(buf, "local%d", i); p_euler[i] = addFloatVectorParam(buf, "Local Euler angles"); p_euler[i]->setActive(0); p_euler[i]->setValue(0.0, 0.0, 0.0); sprintf(buf, "vel%d", i); p_v[i] = addFloatVectorParam(buf, "Velocity"); p_v[i]->setActive(0); p_v[i]->setValue(0.0, 0.0, 0.0); sprintf(buf, "vmag%d", i); p_vmag[i] = addFloatSliderParam(buf, "V-Magnitude"); p_vmag[i]->setActive(0); p_vmag[i]->setValue(0.0, 1.01, 0.0); sprintf(buf, "t__%d", i); p_t[i] = addFloatSliderParam(buf, "Temperature"); p_t[i]->setValue(0.0, 40.0, 20.0); p_t[i]->setActive(0); sprintf(buf, "den%d", i); p_den[i] = addFloatSliderParam(buf, "Density"); p_den[i]->setActive(0); sprintf(buf, "p__%d", i); p_p[i] = addFloatSliderParam(buf, "Pressure"); p_p[i]->setActive(0); sprintf(buf, "k__%d", i); p_k[i] = addFloatSliderParam(buf, "k"); p_k[i]->setActive(0); sprintf(buf, "eps%d", i); p_eps[i] = addFloatSliderParam(buf, "Epsilon"); p_eps[i]->setActive(0); sprintf(buf, "tInt%d", i); p_tin[i] = addFloatSliderParam(buf, "Turb. Intens"); p_tin[i]->setActive(0); sprintf(buf, "tLen%d", i); p_len[i] = addFloatSliderParam(buf, "Turb. Length"); p_len[i]->setActive(0); // multiple scalars int j; //sprintf(buf,"scal%d",i); //p_scalSw[i] = paraSwitch(buf,"Select scalar"); //p_scalSw[i]->setActive(0); for (j = 0; j < MAX_SCALARS; j++) { sprintf(buf, "Scalar %d", j + 1); //paraCase(buf); sprintf(buf, "scal%d_%d", i, j + 1); p_scal[i][j] = addFloatSliderParam(buf, "Scalar"); p_scal[i][j]->setActive(0); //paraEndCase(); } //paraEndSwitch(); // multipla user data //sprintf(buf,"user%d",i); //p_userSw[i] = paraSwitch(buf,"Select UserData"); //p_userSw[i]->setActive(0); for (j = 0; j < MAX_SCALARS; j++) { sprintf(buf, "User %d", j + 1); //paraCase(buf); sprintf(buf, "user%d_%d", i, j + 1); p_user[i][j] = addFloatSliderParam(buf, "User Field"); p_user[i][j]->setActive(0); //paraEndCase(); } //paraEndSwitch(); /// region case ends here paraEndCase(); } paraEndSwitch(); }
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"); }