# -*- coding: iso-8859-1 -*-

###
### This file is generated automatically by SALOME v6.3.1 with dump python functionality
###

import sys
import salome

salome.salome_init()
theStudy = salome.myStudy

import salome_notebook
notebook = salome_notebook.notebook
sys.path.insert( 0, r'/home/r01ken0/concentric_annulus')

import iparameters
ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))

#Set up visual properties:
ipar.setProperty("AP_ACTIVE_VIEW", "VTKViewer_0_0")
ipar.setProperty("AP_WORKSTACK_INFO", "000000010000000000000002010000000100000373000000040000000200000002000000080000001a004f00430043005600690065007700650072005f0030005f00300000000102000000080000001a00560054004b005600690065007700650072005f0030005f00300000000202")
ipar.setProperty("AP_ACTIVE_MODULE", "Mesh")
ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: 1")
#Set up lists:
# fill list AP_VIEWERS_LIST
ipar.append("AP_VIEWERS_LIST", "OCCViewer_1")
ipar.append("AP_VIEWERS_LIST", "VTKViewer_2")
# fill list OCCViewer_1
ipar.append("OCCViewer_1", "OCC scene:1 - viewer:1")
ipar.append("OCCViewer_1", "scale=9.700948370395e+03*centerX=0.000000000000e+00*centerY=3.061862738837e-02*projX=5.773502588272e-01*projY=-5.773502588272e-01*projZ=5.773502588272e-01*twist=0.000000000000e+00*atX=0.000000000000e+00*atY=0.000000000000e+00*atZ=0.000000000000e+00*eyeX=2.886751294136e+02*eyeY=-2.886751294136e+02*eyeZ=2.886751294136e+02*scaleX=1.000000000000e+00*scaleY=1.000000000000e+00*scaleZ=1.000000000000e+00*isVisible=1*size=100.00*gtIsVisible=0*gtDrawNameX=1*gtDrawNameY=1*gtDrawNameZ=1*gtNameX=X*gtNameY=Y*gtNameZ=Z*gtNameColorRX=255*gtNameColorGX=0*gtNameColorBX=0*gtNameColorRY=0*gtNameColorGY=255*gtNameColorBY=0*gtNameColorRZ=0*gtNameColorGZ=0*gtNameColorBZ=255*gtDrawValuesX=1*gtDrawValuesY=1*gtDrawValuesZ=1*gtNbValuesX=3*gtNbValuesY=3*gtNbValuesZ=3*gtOffsetX=2*gtOffsetY=2*gtOffsetZ=2*gtColorRX=255*gtColorGX=0*gtColorBX=0*gtColorRY=0*gtColorGY=255*gtColorBY=0*gtColorRZ=0*gtColorGZ=0*gtColorBZ=255*gtDrawTickmarksX=1*gtDrawTickmarksY=1*gtDrawTickmarksZ=1*gtTickmarkLengthX=5*gtTickmarkLengthY=5*gtTickmarkLengthZ=5")
# fill list VTKViewer_2
ipar.append("VTKViewer_2", "VTK scene:1 - viewer:1")
ipar.append("VTKViewer_2", """<?xml version="1.0"?>
<ViewState>
    <Position X="0.444203" Y="-0.444203" Z="0.481703"/>
    <FocalPoint X="0" Y="0" Z="0.0375"/>
    <ViewUp X="0" Y="0" Z="1"/>
    <ViewScale Parallel="0.0515388" X="1" Y="1" Z="1"/>
    <DisplayCubeAxis Show="0"/>
    <GraduatedAxis Axis="X">
        <Title isVisible="1" Text="X" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="1" G="0" B="0"/>
        </Title>
        <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="1" G="0" B="0"/>
        </Labels>
        <TickMarks isVisible="1" Length="5"/>
    </GraduatedAxis>
    <GraduatedAxis Axis="Y">
        <Title isVisible="1" Text="Y" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="0" G="1" B="0"/>
        </Title>
        <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="0" G="1" B="0"/>
        </Labels>
        <TickMarks isVisible="1" Length="5"/>
    </GraduatedAxis>
    <GraduatedAxis Axis="Z">
        <Title isVisible="1" Text="Z" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="0" G="0" B="1"/>
        </Title>
        <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
            <Color R="0" G="0" B="1"/>
        </Labels>
        <TickMarks isVisible="1" Length="5"/>
    </GraduatedAxis>
    <Trihedron isShown="1" Size="105"/>
</ViewState>
""")
# fill list AP_MODULES_LIST
ipar.append("AP_MODULES_LIST", "Geometry")
ipar.append("AP_MODULES_LIST", "Mesh")


###
### GEOM component
###

import GEOM
import geompy
import math
import SALOMEDS


geompy.init_geom(theStudy)

Vertex_1 = geompy.MakeVertex(0, 0, 0)
Cylinder_1 = geompy.MakeCylinderRH(0.025, 0.075)
Cylinder_2 = geompy.MakeCylinderRH(0.0125, 0.075)
Cut_1 = geompy.MakeCut(Cylinder_1, Cylinder_2)
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
Partition_1 = geompy.MakeHalfPartition(Cut_1, Plane_1)
[Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Partition_1)
non_viscous_faces = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(non_viscous_faces, [31, 42, 21, 45])
inlet = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(inlet, [21, 45])
inner_wall = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(inner_wall, [34, 48])
outer_wall = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(outer_wall, [38, 4])
outlet = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet, [31, 42])
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudyInFather( Partition_1, Compound_1, 'Compound_1' )
geompy.addToStudyInFather( Partition_1, Compound_2, 'Compound_2' )
geompy.addToStudyInFather( Partition_1, Compound_3, 'Compound_3' )
geompy.addToStudyInFather( Partition_1, Compound_4, 'Compound_4' )
geompy.addToStudyInFather( Partition_1, non_viscous_faces, 'non_viscous_faces' )
geompy.addToStudyInFather( Partition_1, inlet, 'inlet' )
geompy.addToStudyInFather( Partition_1, inner_wall, 'inner_wall' )
geompy.addToStudyInFather( Partition_1, outer_wall, 'outer_wall' )
geompy.addToStudyInFather( Partition_1, outlet, 'outlet' )

### Store presentation parameters of displayed objects
import iparameters
ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "GEOM", 1))

#Set up entries:
# set up entry GEOM_6 (Partition_1) parameters
objId = geompy.getObjectID(Partition_1)
ipar.setParameter(objId, "OCCViewer_0_Color", "1:1:0")

###
### SMESH component
###

import smesh, SMESH, SALOMEDS

aMeasurements = smesh.CreateMeasurements()
smesh.SetCurrentStudy(theStudy)
import StdMeshers
Viscous_Layers_1 = smesh.CreateHypothesis('ViscousLayers')
Viscous_Layers_1.SetTotalThickness( 4 )
Viscous_Layers_1.SetNumberLayers( 2 )
Viscous_Layers_1.SetStretchFactor( 1 )
Viscous_Layers_1.SetIgnoreFaces( [ 31, 42, 21, 45 ] )
Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(50)
Nb_Segments_1.SetDistrType( 0 )
Propagation_of_1D_Hyp_on_opposite_edges_1 = Regular_1D.Propagation()
Quadrangle_2D = Mesh_1.Quadrangle()
Hexa_3D = smesh.CreateHypothesis('Hexa_3D')
status = Mesh_1.AddHypothesis(Hexa_3D)
Regular_1D_1 = Mesh_1.Segment(geom=Compound_2)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(5)
Nb_Segments_2.SetDistrType( 0 )
status = Mesh_1.AddHypothesis(Propagation_of_1D_Hyp_on_opposite_edges_1,Compound_2)
isDone = Mesh_1.Compute()
Viscous_Layers_1.SetTotalThickness( 4 )
Viscous_Layers_1.SetNumberLayers( 2 )
Viscous_Layers_1.SetStretchFactor( 1 )
Viscous_Layers_1.SetIgnoreFaces( [ 31, 42, 21, 45 ] )
status = Mesh_1.AddHypothesis(Viscous_Layers_1)
SubMesh_1 = Regular_1D_1.GetSubMesh()

## set object names
smesh.SetName(Viscous_Layers_1, 'Viscous Layers_1')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Propagation_of_1D_Hyp_on_opposite_edges_1, 'Propagation of 1D Hyp. on opposite edges_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D, 'Hexa_3D')
smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
smesh.SetName(SubMesh_1, 'SubMesh_1')

### Store presentation parameters of displayed objects
import iparameters
ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "SMESH", 1))

#Set up entries:
# set up entry SMESH_3 (Mesh_1) parameters
ipar.setParameter("SMESH_3", "VTKViewer_0_Visibility", "On")
ipar.setParameter("SMESH_3", "VTKViewer_0_Representation", "2")
ipar.setParameter("SMESH_3", "VTKViewer_0_IsShrunk", "0")
ipar.setParameter("SMESH_3", "VTKViewer_0_Entities", "e:1:f:1:v:1")
ipar.setParameter("SMESH_3", "VTKViewer_0_Colors", "surface:0:0.666667:1:backsurface:0:0:1:edge:0:0.666667:1:node:1:0:0")
ipar.setParameter("SMESH_3", "VTKViewer_0_Sizes", "line:1:shrink:0.75")
ipar.setParameter("SMESH_3", "VTKViewer_0_PointMarker", "std:1:9")
ipar.setParameter("SMESH_3", "VTKViewer_0_Opacity", "1")
ipar.setParameter("SMESH_3", "VTKViewer_0_ClippingPlane", "Off")


if salome.sg.hasDesktop():
  salome.sg.updateObjBrowser(1)
  iparameters.getSession().restoreVisualState(1)
