CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > 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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 10, 2012, 01:52
Question Best way to select all region objects in java
  #1
New Member
 
Join Date: May 2009
Posts: 4
Rep Power: 16
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.

Regards,
-Showerlin
showerlin is offline   Reply With Quote

Old   April 10, 2012, 08:48
Default
  #2
Member
 
Krishna
Join Date: Apr 2012
Posts: 54
Rep Power: 13
kri321shna is on a distinguished road
u can use collector concept.
kri321shna is offline   Reply With Quote

Old   April 10, 2012, 09:14
Default
  #3
New Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 16
frogotron is on a distinguished road
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);
kri321shna likes this.
frogotron is offline   Reply With Quote

Reply

Tags
java region

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 14:44.