CFD Online Logo CFD Online URL
Home > Forums > STAR-CCM+

Best way to select all region objects in java

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By frogotron

LinkBack Thread Tools Display Modes
Old   April 10, 2012, 00:52
Question Best way to select all region objects in java
New Member
Join Date: May 2009
Posts: 4
Rep Power: 8
showerlin is on a distinguished road
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.

showerlin is offline   Reply With Quote

Old   April 10, 2012, 07:48
New Member
Join Date: Apr 2012
Posts: 15
Rep Power: 5
kri321shna is on a distinguished road
u can use collector concept.
kri321shna is offline   Reply With Quote

Old   April 10, 2012, 08:14
New Member
Join Date: Oct 2009
Posts: 5
Rep Power: 7
frogotron is on a distinguished road

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()){
constrainedPlaneSection_0.getInputParts().setObjec ts(allRegList);
kri321shna likes this.
frogotron is offline   Reply With Quote


java region

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi region meshing & recovering the original patch names fluidpath OpenFOAM Native Meshers: snappyHexMesh and Others 4 May 19, 2013 19:13
Using starToFoam clo OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 33 September 26, 2012 04:04
StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15
Import gmsh msh to Foam adorean Open Source Meshers: Gmsh, Netgen, CGNS, ... 24 April 27, 2005 08:19

All times are GMT -4. The time now is 02:00.