|
[Sponsors] |
Best way to select all region objects in java |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 10, 2012, 01:52 |
Best way to select all region objects in java
|
#1 |
New Member
Join Date: May 2009
Posts: 4
Rep Power: 17 |
Dear Experts,
Sorry to bother another pretty dump questions... I'm writing a simple java script to automate a series of "constrained plane" for the geometry in order to calculate the mass flow for each channels. it works well when the model only have one region. now the geometry getting more complex and the channels now split into different regions. and the code won't work well. I can still make it work by manually changing the name in the code to match the region I'm working on. but I'm looking for more generalize solution. is there any clean way to do something like "select-all-regions"? with simple example would be really really appreciated... since I'm still new to CCM... Many thanks for the great help. Regards, -Showerlin |
|
April 10, 2012, 08:48 |
|
#2 |
Member
Krishna
Join Date: Apr 2012
Posts: 54
Rep Power: 14 |
u can use collector concept.
|
|
April 10, 2012, 09:14 |
|
#3 |
New Member
Join Date: Oct 2009
Posts: 5
Rep Power: 17 |
Hi
You can use a bit of code like Simulation sim = getActiveSimulation(); Collection<Region> allReg = sim.getRegionManager().getRegions(); Units units_0 = ((Units) sim.getUnitsManager().getObject("m")); ConstrainedPlaneSection constrainedPlaneSection_0 = (ConstrainedPlaneSection) sim.getPartManager().createConstrainedPlaneImplici tPart(new NeoObjectVector(new Object[] {}), new DoubleVector(new double[] {}), units_0); constrainedPlaneSection_0.getInputParts().setObjec ts(allReg); You need to be careful if you have deleted regions in your model. If so then you need to make an empty entity and fill it with the appropriate regions eg. ArrayList<Region> allRegList= new ArrayList<Region>(); for(Region r: sim.getRegionManager().getRegions()){ if(!r.getPresentationName().contains("dele")){ allRegList.add(r); } } constrainedPlaneSection_0.getInputParts().setObjec ts(allRegList); |
|
Tags |
java region |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] Multi region meshing & recovering the original patch names | fluidpath | OpenFOAM Meshing & Mesh Conversion | 4 | May 19, 2013 20:13 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |
[Other] StarToFoam error | Kart | OpenFOAM Meshing & Mesh Conversion | 1 | February 4, 2010 05:38 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 05:15 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 09:19 |