public CSMGEN() { UTIL.printDate(PR); // Hash table for storing mesh blocks //blocks = new HashMap(); blocks = new Dictionary <string, model.FeModel>(); while (RD.hasNext()) { String name = RD.next().ToLower(); if (name.Equals("#")) { RD.nextLine(); continue; } PR.WriteLine("------------------------------------"); try { Activator.CreateInstance(null, "FEA3D.gener." + name); //Class.forName("gener." + name).newInstance(); } catch (Exception e) { UTIL.errorMsg("Class name not found: " + name + "\n\n\n" + e.ToString()); } } PR.Close(); }
private void readDataFile(FeScanner es) { vars name = vars.NONE; String s; Material mat; it = defDs.GetEnumerator(); while (es.hasNext()) { varName = es.next(); String varname = varName.ToLower(); if (varname.Equals("#")) { es.nextLine(); continue; } try { name = (vars)System.Enum.Parse(typeof(vars), varname);//vars.valueOf(varname); //Console.WriteLine("hmm"); } catch (Exception E) { UTIL.errorMsg("Variable name is not found: " + varName); } switch (name) { case vars.nel: nEl = es.readInt(); //Console.WriteLine("FEMODEL: "+nEl.ToString()); break; case vars.nnod: nNod = es.readInt(); //Console.WriteLine("FEMODEL: " + nNod.ToString()); break; case vars.ndim: nDim = es.readInt(); nDf = nDim; //Console.WriteLine("FEMODEL: " + nDf.ToString()); break; case vars.stressstate: s = es.next().ToLower(); try { stressState = (StrStates)System.Enum.Parse(typeof(StrStates), s); //StrStates.valueOf(s); } catch (Exception E) { UTIL.errorMsg("stressState has forbidden value: " + s); } if (stressState != StrStates.threed) { nDim = nDf = 2; } else { nDim = nDf = 3; } //Console.WriteLine("FEMODEL: " + stressState.ToString()); break; case vars.physlaw: s = es.next().ToLower(); try { physLaw = (PhysLaws)System.Enum.Parse(typeof(PhysLaws), s); //PhysLaws.valueOf(s); } catch (Exception E) { UTIL.errorMsg("physLaw has forbidden value: " + s); } //Console.WriteLine("FEMODEL: " + s.ToString()); break; case vars.solver: s = es.next().ToLower(); try { Solver.solver = (Solver.solvers)System.Enum.Parse(typeof(Solver.solvers), s); //Solver.solvers.valueOf(s); } catch (Exception E) { UTIL.errorMsg("solver has forbidden value: " + s); } //Console.WriteLine("FEMODEL: " + s.ToString()); break; case vars.elcon: readElemData(es); break; case vars.nodcoord: if (nNod == 0 || nDim == 0) { UTIL.errorMsg("nNod and nDim should be specified before nodCoord"); } nEq = nNod * nDim; // Nodal coordinates newCoordArray(); for (int i = 0; i < nNod; i++) { for (int j = 0; j < nDim; j++) { setNodeCoord(i, j, es.readDouble()); } } break; case vars.material: String matname = es.next(); mat = Material.newMaterial(physLaw.ToString(), stressState.ToString()); double e = es.readDouble(); double nu = es.readDouble(); double alpha = es.readDouble(); mat.setElasticProp(e, nu, alpha); if (physLaw == PhysLaws.elplastic) { double sY = es.readDouble(); double km = es.readDouble(); double mm = es.readDouble(); mat.setPlasticProp(sY, km, mm); } materials.Add(matname, mat); //Console.WriteLine("FEMODEL: " + matname); break; case vars.constrdispl: readConstrDisplacements(es); break; case vars.boxconstrdispl: createBoxConstrDisplacements(es); break; case vars.thermalloading: s = es.next(); if (s.ToLower().Equals("y")) { thermalLoading = true; } else if (s.ToLower().Equals("n")) { thermalLoading = false; } else { UTIL.errorMsg("thermalLoading should be y/n. Specified: " + s); } break; case vars.includefile: s = es.next(); FeScanner R = new FeScanner(s); readDataFile(R); break; case vars.trussarea: readTrussArea(es); break; case vars.end: return; } } }
static void readDataFile(FeScanner RD) { vars name = vars.none; while (RD.hasNext()) { String varName = RD.next(); String varNameLower = varName.ToLower(); if (varName.Equals("#")) { RD.nextLine(); continue; } try { name = (vars)System.Enum.Parse(typeof(vars), varNameLower); } catch (Exception e) { UTIL.errorMsg("Variable name is not found: " + varName); } switch (name) { case vars.meshfile: meshFile = RD.next(); break; case vars.resultfile: resultFile = RD.next(); break; case vars.parm: try { varName = RD.next(); parm = (parms)System.Enum.Parse(typeof(parms), varName.ToLower()); } catch (Exception e) { UTIL.errorMsg("No such result parameter: " + varName); } break; case vars.showedges: showEdges = RD.next().Equals("y"); break; case vars.shownodes: showNodes = RD.next().Equals("y"); break; case vars.ndivmin: nDivMin = RD.readInt(); break; case vars.ndivmax: nDivMax = RD.readInt(); break; case vars.fmin: fMin = RD.readDouble(); break; case vars.fmax: fMax = RD.readDouble(); break; case vars.ncontours: nContours = RD.readInt(); break; case vars.deformscale: deformScale = RD.readDouble(); break; case vars.end: return; default: return; } } }
// Read data fragment for load increment. // newLoad = true - beginning of new load, // = false - continuation of load. // returns true if load data has been read private bool readDataFile(FeScanner es, bool newLoad) { if (newLoad) { scaleLoad = 0; nodForces = new List <Dof>(); itnf = nodForces.GetEnumerator(); surForces = new List <ElemFaceLoad>(); itsf = surForces.GetEnumerator(); if (fem.thermalLoading) { for (int i = 0; i < dtemp.Length; i++) { dtemp[i] = 0.0; } } for (int i = 0; i < dDispl.Length; i++) { dDispl[i] = 0.0; } } if (!es.hasNext()) { return(false); // No load data } vars name = vars.NONE; String s; while (es.hasNext()) { String varName = es.next(); String varNameLower = varName.ToLower(); if (varName.Equals("#")) { es.nextLine(); continue; } try { name = (vars)System.Enum.Parse(typeof(vars), varNameLower); //vars.valueOf(varNameLower); } catch (Exception E) { UTIL.errorMsg("Variable name is not found: " + varName); } switch (name) { case vars.loadstep: loadStepName = es.next(); //Console.WriteLine("FELOAD " + loadStepName.ToString()); break; case vars.scaleload: scaleLoad = es.readDouble(); //Console.WriteLine("FELOAD " + scaleLoad.ToString()); break; case vars.residtolerance: residTolerance = es.readDouble(); //Console.WriteLine("FELOAD " + residTolerance.ToString()); break; case vars.maxiternumber: maxIterNumber = es.readInt(); //Console.WriteLine("FELOAD " + maxIterNumber.ToString()); break; case vars.nodforce: readNodalForces(es); break; case vars.surforce: readSurForces(es); break; case vars.boxsurforce: createBoxSurForces(es); break; case vars.nodtemp: dtemp = new double[fem.nNod]; for (int i = 0; i < fem.nNod; i++) { dtemp[i] = es.readDouble(); } break; case vars.includefile: s = es.next().ToLower(); FeScanner R = new FeScanner(s); readDataFile(R, false); break; case vars.anglesurforce: createAngleSurForce(es); break; case vars.surforcelist: createSurForceList(es); break; case vars.elemanglesurforce: createElemAngleSurForce(es); break; case vars.end: return(true); } } return(true); }