*# Vynulovat vsechno
*#                          UniqueSurfaceList(Surfacec_Index)
*#			      Draw_Each_Iteration
*#                              Surface_List
*#                                Attribute_List
*#                                  MinMax_List
*#				      Item_At
*#				        CheckName(Use_MonitorName)
*#					  MonitorName(Name)
*#				    	    UniqueMonitorName
*# WarningBox Warning: pred iniciaci TK_InitSurfaceCriteria
*tcl(TK_InitSurfaceCriteria 0 0 0 0 0 0 0 0 0)*\
*#
*# pri prvnim pruchodu naplnim pole SurfaceList(List_of_Monitored_Surfaces)
*#                                  UniqueSurfaceList(Surfacec_Index)
*#                                  AttributeList(Data_Attributes)
*#                                  MinMaxList(Minimum_or_Maximum)
*#				    CheckName(Use_MonitorName)
*#				    MonitorName(Name)
*#				    UniqueMonitorName
*#
*# WarningBox Warning: pred 1.pruchodem loop Intervals a TK_C.A.C.Info
*loop Intervals
*#
*Set Cond MaxMonitor_for_Surface *nodes  *CanRepeat
*#
*If(CondNumEntities(Int)>0)
*# // selection has *CondNumEntities entities
*loop nodes *OnlyInCond
*# vn  *Cond(Entity_number,int)
*# dei *Cond(Draw_Each_Iteration,int)
*# ia  *Cond(Item_At,int)
*# da  *Cond(Data_Attribute)
*# g   *Cond(Global_MM)
*# mn *Cond(MonitorName)
*# //   *NodesNum *Cond(Data_Attribute) *Cond(Global_MM) *Cond(Item_At,int) *Cond(Draw_Each_Iteration,int) *Cond(Entity_number,int) *Cond(IdentificationByName,int) *Cond(MonitorName)
*tcl(TK_CreateSurfaceArraysCriteriaInfo *Cond(Data_Attribute) *Cond(Global_MM) *Cond(Item_At) *Cond(Draw_Each_Iteration,int) *Cond(Entity_number,int) *Cond(IdentificationByName,int) *Cond(MonitorName))*\
*#
*End nodes
*EndIf
*break
*End Intervals

*#GenData(UniqueSurfaceList,int)
*#GenData(SurfaceList,int)
*#GenData(AttributeList,int)
*#GenData(MinMaxList,int)
*#
*# pri druhem pruchodu je Vypis selections pro Surfaces
*#
*#
*# WarningBox Warning: pred 2.pruchodem
*for(j=1;j<=GenData(UniqueMonitorName,Int);j=j+1)
*If(strcmp(GenData(UniqueMonitorName,*j),"Change_Monitor_Name_without_space!")!=0 && strcmp(GenData(UniqueMonitorName,*j),"-1")!=0)
*#GenData(UniqueSurfaceList)
*If(GenData(UniqueSurfaceList,1,Int)>0)
*for(i=1;i<=GenData(UniqueSurfaceList,Int);i=i+1)
SELECTION "NODES for SURFACE *GenData(UniqueSurfaceList,*i,int) for *GenData(UniqueMonitorName,*j)" LIST *\
*loop Intervals
*#
*Set Cond MaxMonitor_for_Surface *nodes *CanRepeat
*#
*If(CondNumEntities(Int)>0)
*# // selection has *CondNumEntities entities
*loop nodes *OnlyInCond
*#
*#NodesNum *Cond(Entity_number,int) *GenData(UniqueSurfaceList,*i,int) *Cond(MonitorName) *GenData(UniqueMonitorName,*j) *\
*If(Cond(Entity_number,int) == GenData(UniqueSurfaceList,*i,int))
*If(strcmp(Cond(MonitorName),GenData(UniqueMonitorName,*j))==0)
*#NodesNum *Cond(Entity_number,int) *GenData(UniqueSurfaceList,*i,int) *Cond(MonitorName) *GenData(UniqueMonitorName,*i)
*NodesNum *\
*EndIf
*EndIf
*#
*End nodes
*EndIf
 ;
*break
*End Intervals
*End
*EndIf

*EndIf
*End

*#
*# pri tretim pruchodu je zdruzeni SELECTION pro Monitoring vice makroprvku 
*#     v jednom Monitoru
*#
*# WarningBox Warning: pred 3.pruchodem

*for(i=1;i<=GenData(UniqueMonitorName,Int);i=i+1)
*If(strcmp(GenData(UniqueMonitorName,*i),"Change_Monitor_Name_without_space!")!=0 && strcmp(GenData(UniqueMonitorName,*i),"-1")!=0)
SELECTION "*GenData(UniqueMonitorName,*i)"  
*for(j=1;j<=GenData(UniqueSurfaceList,Int);j=j+1)
*#If(GenData(CheckName,*j,Int)==1)
*#If(strcmp(GenData(UniqueMonitorName,*i),GenData(MonitorName,*i))==0)
	include "NODES for SURFACE *GenData(UniqueSurfaceList,*j,Int) for *GenData(UniqueMonitorName,*i)"
*#EndIf
*#EndIf
*end
 REMOVE_DUPLICATES 
 ;
*EndIf
*end	
*#
*# pri ctvrtem pruchodu je Output_Data - Data_Attribute
*#
*# WarningBox Warning: pred 4.pruchodem

*# // Monitors identify by name of monitor *GenData(SurfaceList,1,Int) 
*If(GenData(SurfaceList,1,Int)>0)
*for(i=1;i<=GenData(UniqueMonitorName,Int);i=i+1)
*Set Var first=1
*for(j=1;j<=GenData(MonitorName,Int);j=j+1)
*# --------
*# i=*i
*# --------
*# *GenData(UniqueMonitorName,*i)
*# *GenData(MonitorName,*j)
*# *GenData(CheckName,*j,Int)
*# *first
*# --------
*If(strcmp(GenData(UniqueMonitorName,*i),GenData(MonitorName,*j))==0 && GenData(CheckName,*j,Int)==1 && first==1)
*Set Var first=0
*Set Var nMaxMonitor=Operation(nMaxMonitor+1)
Output Name "*GenData(UniqueMonitorName,*i)*\
*If(strcmp(GenData(MinMaxList,*j),"MAXIMUM")==0 || strcmp(GenData(MinMaxList,*j),"MINIMUM")==0)
_*GenData(MinMaxList,*j)*\
*EndIf
_*GenData(AttributeList,*j)_DIR_*GenData(Item_At,*j)" *\
*If(GenData(Draw_Each_Iteration,*j,int)==1)
MONITOR_1 EACH ITERATION *\
*Else
MONITOR_2 *\
*EndIf
*GenData(MinMaxList,*j) LOCATION NODES NODE AT SELECTION *\
"*GenData(MonitorName,*j)"  *\
DATA LIST "*GenData(AttributeList,*j)" *\
*If(strcmp(GenData(Item_At,*j),"all")!=0)
 ITEM AT *GenData(Item_At,*j) *\
*EndIf
 End ;
*EndIf
*end
*End
*EndIf
*#
*# WarningBox Warning: pred 5.pruchodem

*# // Monitors identify by Makroelement ID *GenData(SurfaceList,1,Int) 
*If(GenData(CheckName,Int)>0)
*for(i=1;i<=GenData(SurfaceList,Int);i=i+1)
*If(GenData(CheckName,*i,Int)==0)
*Set Var nMaxMonitor=Operation(nMaxMonitor+1)
Output Name "*\
*If(strcmp(GenData(MinMaxList,*i),"MAXIMUM")==0 || strcmp(GenData(MinMaxList,*i),"MINIMUM")==0)
_*GenData(MinMaxList,*i)*\
*EndIf
_Surf*GenData(SurfaceList,*i,int)_*GenData(AttributeList,*i)_DIR_*GenData(Item_At,*i)" *\

*If(GenData(Draw_Each_Iteration,*i,int)==1)
MONITOR_1 EACH ITERATION *\
*Else
MONITOR_2 *\
*EndIf
*GenData(MinMaxList,*i) LOCATION NODES NODE AT SELECTION *\
"NODES for SURFACE *GenData(SurfaceList,*i,int)" *\
DATA LIST "*GenData(AttributeList,*i)" *\
*If(strcmp(GenData(Item_At,*i),"all")!=0)
 ITEM AT *GenData(Item_At,*i) *\
*EndIf
 End ;
*EndIf
*End
*EndIf
