static double create_node (double inpid, double parid, int recurse) { int ierr, nchild, nc, cnt; char name[ADF_NAME_LENGTH+1],type[ADF_LABEL_LENGTH+1]; double outid, inpchild; ADF_Get_Name (inpid, name, &ierr); if (ierr > 0) error_exit ("ADF_Get_Name", ierr); ADF_Get_Label (inpid, type, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (!keep_nodes) { if (FileVersion < 2100 && 0 == strcmp (type, "UserDefinedData_t")) return 0.0; if (FileVersion < 2400 && (0 == strcmp (type, "AdditionalUnits_t") || 0 == strcmp (type, "AdditionalExponents_t"))) return 0.0; } ADF_Is_Link (inpid, &cnt, &ierr); if (ierr > 0) error_exit ("ADF_Is_Link", ierr); /* create link */ if (cnt > 0 && keep_links) { ADF_Get_Link_Path (inpid, linkfile, linkpath, &ierr); if (ierr > 0) error_exit ("ADF_Get_Link_Path", ierr); ADF_Link (parid, name, linkfile, linkpath, &outid, &ierr); if (ierr > 0) error_exit ("ADF_Link", ierr); return 0.0; } /* create node */ ADF_Create (parid, name, &outid, &ierr); if (ierr > 0) error_exit ("ADF_Create", ierr); copy_node (inpid, outid); if (!recurse) return outid; /* recurse on children */ ADF_Number_of_Children (inpid, &nchild, &ierr); if (ierr > 0) error_exit ("ADF_Number_of_Children", ierr); if (nchild < 1) return outid; if (FileVersion < 2100 && 0 == strcmp (type, "FlowEquationSet_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "ThermalRelaxationModel_t") && strcmp (label, "ChemicalKineticsModel_t") && strcmp (label, "EMElectricFieldModel_t") && strcmp (label, "EMMagneticFieldModel_t") && strcmp (label, "EMConductivityModel_t")) create_node (inpchild, outid, 1); } } else if (FileVersion < 2400 && 0 == strcmp (type, "FlowEquationSet_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "EMElectricFieldModel_t") && strcmp (label, "EMMagneticFieldModel_t") && strcmp (label, "EMConductivityModel_t")) create_node (inpchild, outid, 1); } } else if (FileVersion < 2400 && 0 == strcmp (type, "UserDefinedData_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "UserDefinedData_t") && strcmp (label, "FamilyName_t") && strcmp (label, "Ordinal_t") && strcmp (label, "GridLocation_t") && strcmp (label, "IndexArray_t") && strcmp (label, "IndexRange_t")) create_node (inpchild, outid, 1); } } else if (FileVersion < 2400 && 0 == strcmp (type, "GridConnectivity1to1_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "GridConnectivityProperty_t")) create_node (inpchild, outid, 1); } } else if (FileVersion < 2400 && 0 == strcmp (type, "Family_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "RotatingCoordinates_t")) create_node (inpchild, outid, 1); } } else if (FileVersion < 2400 && 0 == strcmp (type, "FamilyBC_t")) { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); ADF_Get_Label (inpchild, label, &ierr); if (ierr > 0) error_exit ("ADF_Get_Label", ierr); if (strcmp (label, "BCDataSet_t")) create_node (inpchild, outid, 1); } } else { for (nc = 1; nc <= nchild; nc++) { inpchild = get_child_id (inpid, nc); create_node (inpchild, outid, 1); } } return outid; }
/** * Gets the id of a widget in a grid child cell. * * @param parent_id The id of the parent grid. * @param row Row number in the grid. * @param col Column number in the grid. * * @returns The id of the widget. */ std::string get_child_widget_id( const std::string& parent_id, const unsigned row, const unsigned col) { return get_child_id(parent_id, row, col) + "_W"; }