!*********************************************************************************************************************************************************!
!* Copyright (c) <2015> <Purdue University> All rights reserved.																					     *!
!*                                                                      																			     *!
!* Developed by:  Fang Jiang, Wenbin Yu                                                                                                                  *!
!*        <Prof. Yu’s Research Group>,                                                                                                                   *!
!*        <School of Aeronautics and Astronautics, Purdue University>                                                                                    *!
!*        <https://cdmhub.org/projects/ansysvabsgui2015>                                                                                                 *!
!*                                                                      																			     *!
!* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),    *!
!* to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,  *!
!* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:            *!
!*                                                                      																			     *!
!* •Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.                        *!
!*                                                                      																			     *!
!* •Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation *!
!*  and/or other materials provided with the distribution.                                                                                               *!
!*                                                                      																			     *!
!* •Neither the names of < Prof. Yu’s Research Group, School of Aeronautics and Astronautics, Purdue University >,                                       *!
!*  nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.   *!
!*                                                                      																			     *!
!* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *!
!* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *!
!* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER     *!
!* DEALINGS WITH THE SOFTWARE. 																															 *!
!*********************************************************************************************************************************************************!
!#7
!============================================================
! element-layer-orientation block
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! If format_flag = 1
!~~~~~~~~~~~~~~~~~~~
! elem_no; layer_type; theta1
!------------------------------------------------------------
!Although the arrangement of elem no is not necessary to be consecutive, 
!every element starting from 1 to nelem should be present.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*CFOPEN, VABS_Check/VABSGen_7_elemno_layerid_theta1, dat

!================================================
*IF, BSL_flag, EQ, 19870503, THEN
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*DO,s,1,ORIL_NUM                                ! loop baseline number
	i = ORIL(s)                                 ! "i" is the baseline number
	LD = LAMDIREC_BSL_%i%
	*DO,j, 1, nlam_bsl_%i%_direc_%LD%           !loop layer numbers, "j" is the lamina ORDER in the laminating order
		q = anum_BSL%i%(j)                      !get Area number from layer order
*VWRITE,elistA%q%(1),elayrA%q%(1),etheta1A%q%(1)
(F9.0,TL1,' ', 2X, F9.0,TL1,' ', 2X, E13.5) 
	*ENDDO
*ENDDO
		!-----------------------------
		*IF, PatchCounter, NE, 0, THEN
			*DO, i, 1, PatchCounter
				apn = Patch_Anum(i)	
*VWRITE,elistA%apn%(1),elayrA%apn%(1),etheta1A%apn%(1)
(F9.0,TL1,' ', 2X, F9.0,TL1,' ', 2X, E13.5) 
			*ENDDO
		*ENDIF
*VWRITE 
(' ')
	!================================================
	*ELSEIF, BSL_flag, NE, 19870503, AND, isoflag, EQ, 1
	!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*DO, i, 1, PatchCounter
	apn = Patch_Anum(i)
*VWRITE,elistA%apn%(1),elayrA%apn%(1),etheta1A%apn%(1)
(F9.0,TL1,' ', 2X, F9.0,TL1,' ', 2X, E13.5) 
*ENDDO
*VWRITE
(' ')
	!================================================
	*ELSE
	!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*ENDIF

*CFCLOS