*#            ElemsType:
*#           		1=Linear,
*#           		2=Triangle,
*#           		3=Quadrilateral,
*#           		4=Tetrahedra,
*#           		5=Hexahedra,
*#           		6=Prism,
*#           		7=OnlyPoints.
*#
*# loop materials
*# If(ElemsMat==MatNum)
*Set Var check2dinterfmat=Operation(strcmp(ElemsMatProp(Material_Prototype),"CC2DInterface"),Int)
*Set Var check3dinterfmat=Operation(strcmp(ElemsMatProp(Material_Prototype),"CC3DInterface"),Int)
*Set Var checkinterfmat=Operation(check3dinterfmat*check2dinterfmat)
*#
*#Set Var ElemsNnode=Operation(ElemsNnode*1,Int)
*#set var ElemsNnode = *tcl(string trim *ElemsNnode)
*#tcl(proc MultiplyByTwo { x } { return [expr {$x*2}] })*\
*#tcl(proc TrimString { x } { return [string trim $x] })*\
*tcl(proc TrimString { x } { return [expr {$x*2}] })*\
*Set var ElemsNnode=tcl(TrimString *ElemsNnode)
*# ////// zjisteni kvadratic
*Set Var MaterialNonQuadratic=ElemsMatProp(Non-Quadratic_Element,Int)
*Set Var JeQuadratic = IsQuadratic(Int)
*If(MaterialNonQuadratic==1 && JeQuadratic==1)
*Set Var JeQuadratic = 2
*#// Non Qadratic element
*#// JeQuadratic = *JeQuadratic
*EndIf
*# ////// zjisteni kvadratic end
*#
*#//interface mat je checkinterfmat = - *checkinterfmat -      , JeQuadratic= *JeQuadratic , MaterialNonQuadratic= *MaterialNonQuadratic
*If(QuadraticGapMeshWarning==0 && checkinterfmat==0 && JeQuadratic==1 && MaterialNonQuadratic==1)
*WarningBox Warning: There are some quadratic GAP elements in your mesh. Be sure, that in neighbour is not any NonQudratic material.
*Set Var QuadraticGapMeshWarning = 1
*EndIf
*#
*# // 1: ElemsType=*ElemsType, IsQuadratic=*IsQuadratic(Int), ElemsNnode=*ElemsNnode, checkinterfmat=*checkinterfmat
*Intformat "%10i"
*Set Var MaxElemsNum=ElemsNum 
*If(strcmp(ElemsMatProp(Material_Prototype),"CCSpringMaterial")==0)
*#
*include ..\include.src.bas\Spring_MaterialElement_Conectivity.bas
*#
*ElseIf( ElemsType==2 && JeQuadratic==0 && ElemsNnode==3 && checkinterfmat!=0 )
*#// TRIANGLE linearni
*ElemsNum *ElemsConec
*#
*#
*ElseIf( ElemsType==2 && JeQuadratic==1 && ElemsNnode==6 && checkinterfmat!=0 )
*#// TRIANGLE kvadraticky
*ElemsNum *ElemsConec
*# (4) *ElemsConec(5) *ElemsConec(6) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) 
*#
*#
*ElseIf( ElemsType==2 && JeQuadratic==2 && ElemsNnode==6 && checkinterfmat!=0 )
*#// TRIANGLE kvadraticky - linearni
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) 
*#
*#
*ElseIf( ElemsType==3 && JeQuadratic==0 && ElemsNnode==4 && checkinterfmat!=0 )
*# // QUAD linearni
*ElemsNum *ElemsConec
*#
*#
*ElseIf( ElemsType==3 && JeQuadratic==0 && ElemsNnode==4 && checkinterfmat==0 )
*# // QUAD linearni GAP
*ElemsNum *ElemsConec
*#
*#
*ElseIf( ElemsType==3 && JeQuadratic==1 && ElemsNnode==8 && checkinterfmat!=0 )
*# // QUAD kvadraticky
*ElemsNum *ElemsConec
*# (5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==3 && JeQuadratic==2 && ElemsNnode==8 && checkinterfmat!=0 )
*# // QUAD kvadraticky - linearni
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==3 && JeQuadratic==1 && ElemsNnode==8 && checkinterfmat==0 )
*# // QUAD kvadraticky GAP
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4) *ElemsConec(5) *ElemsConec(7)
*#
*#
*ElseIf( ElemsType==4 && JeQuadratic==0 && ElemsNnode==4 && checkinterfmat!=0 )
*# // TETRAHERON linearni
*ElemsNum *ElemsConec
*#
*#
*ElseIf( ElemsType==4 && JeQuadratic==1 && ElemsNnode==10 && checkinterfmat!=0 )
*# // TETRAHERON kvadraticky
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4) *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(9) *ElemsConec(10) *ElemsConec(8)
*#
*#
*ElseIf( ElemsType==4 && JeQuadratic==2 && ElemsNnode==10 && checkinterfmat!=0 )
*# // TETRAHERON kvadraticky - linearni
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==0 && ElemsNnode==8 && checkinterfmat(Int)!=0 )
*# // HEXAHEDRA linearni
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==0 && ElemsNnode==8 && checkinterfmat(Int)==0 )
*# // HEXAHEDRA linearni GAP interfaElemsNnode
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==1 && ElemsNnode==20 && checkinterfmat!=0 )
*# // HEXAHEDRA kvadraticky
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4) *ElemsConec(17) *ElemsConec(18) *ElemsConec(19) *ElemsConec(20) *ElemsConec(9) *ElemsConec(10) *ElemsConec(11) *ElemsConec(12) *ElemsConec(13) *ElemsConec(14) *ElemsConec(15) *ElemsConec(16)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==2 && ElemsNnode==20 && checkinterfmat!=0 )
*# // HEXAHEDRA kvadraticky - linearni
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==1 && ElemsNnode==20 && checkinterfmat==0 )
*# // HEXAHEDRA kvadraticky GAP
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4) *ElemsConec(17) *ElemsConec(18) *ElemsConec(19) *ElemsConec(20) *ElemsConec(9) *ElemsConec(10) *ElemsConec(11) *ElemsConec(12)
*#
*#
*ElseIf( ElemsType==5 && JeQuadratic==2 && ElemsNnode==20 &&  checkinterfmat(Int)==0 )
*# // HEXAHEDRA kvadraticky - linearni GAP
*ElemsNum *ElemsConec(5) *ElemsConec(6) *ElemsConec(7) *ElemsConec(8) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3) *ElemsConec(4)
*#
*#
*ElseIf( ElemsType==6 && JeQuadratic==0 && ElemsNnode==6 && checkinterfmat==0)
*# // PRISM linearni - GAP kontaktni element
*ElemsNum *ElemsConec(4) *ElemsConec(5) *ElemsConec(6) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3)
*#
*#
*ElseIf( ElemsType==6 && JeQuadratic==1 && ElemsNnode==15 && checkinterfmat==0)
*# // PRISM kvadraticky - GAP kontaktni element
*ElemsNum *ElemsConec(4) *ElemsConec(5) *ElemsConec(6) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3)  *ElemsConec(13) *ElemsConec(14) *ElemsConec(15) *ElemsConec(7) *ElemsConec(8) *ElemsConec(9) 
*#ElemsConec(10) *ElemsConec(11) *ElemsConec(12)
*#
*#
*ElseIf( ElemsType==6 && JeQuadratic==2 && ElemsNnode==15 &&  checkinterfmat(Int)==0 )
*# // PRISM kvadraticky - linearni GAP
*ElemsNum *ElemsConec(4) *ElemsConec(5) *ElemsConec(6) *ElemsConec(1) *ElemsConec(2) *ElemsConec(3)
*#
*#
*ElseIf( ElemsType==6 && JeQuadratic==0 && ElemsNnode==6 && checkinterfmat!=0 )
*#// WEDGE linearni
*ElemsNum *ElemsConec(1) *ElemsConec(3) *ElemsConec(2) *ElemsConec(4) *ElemsConec(6) *ElemsConec(5)
*#
*#
*ElseIf( ElemsType==6 && JeQuadratic==1 && ElemsNnode==15 && checkinterfmat!=0 )
*#// WEDGE kvadraticky 
*ElemsNum *ElemsConec(1) *ElemsConec(3) *ElemsConec(2) *ElemsConec(4) *ElemsConec(6) *ElemsConec(5) *ElemsConec(9) *ElemsConec(8) *ElemsConec(7) *ElemsConec(15) *ElemsConec(14) *ElemsConec(13) *ElemsConec(10) *ElemsConec(12) *ElemsConec(11)
*#
*#ElseIf( ElemsType==6 && JeQuadratic==1 && ElemsNnode==15 && checkinterfmat!=0 && shell material)
*#// WEDGE kvadraticky - 12 bodu - trojuhelnikovy shell - zdá se že funguje i při zápisu všech 15 bodů, viz výše
*#ElemsNum *ElemsConec(1) *ElemsConec(3) *ElemsConec(2) *ElemsConec(4) *ElemsConec(6) *ElemsConec(5) *ElemsConec(9) *ElemsConec(8) *ElemsConec(7) *ElemsConec(15) *ElemsConec(14) *ElemsConec(13)
*#
*ElseIf( ElemsType==6 && JeQuadratic==2 && ElemsNnode==15 && checkinterfmat!=0 )
*#// WEDGE kvadraticky - linearni
*ElemsNum *ElemsConec(1) *ElemsConec(3) *ElemsConec(2) *ElemsConec(4) *ElemsConec(6) *ElemsConec(5)
*#
*#
*ElseIf(ElemsType==1 && JeQuadratic==1)
*#// LINEAR kvadraticky
*ElemsNum *ElemsConec(1) *ElemsConec(2) *ElemsConec(3)
*ElseIf(ElemsType==1 && JeQuadratic==0)
*#// LINEAR linearni
*ElemsNum *ElemsConec(1) *ElemsConec(2)
*Else
// Unknown element type  - vsechny ostatni pripady
ElemsNum = *ElemsNum ElemsConec = *ElemsConec
// 2: ElemsType=*ElemsType, JeQuadratic=*JeQuadratic, ElemsNnode=*ElemsNnode, checkinterfmat=*checkinterfmat
*WarningBox Info: Unknown element type was written to inp file. Find "Unknown element type" in inp file. 
*EndIf
*# break
*#
*# EndIf
*# End materials
*#
*Set Var PreviousType=CurrentType
*Set Var PreviousIndex=groupID
*Set Var oldElemsMat=ElemsMat(Int) 