!*********************************************************************************************************************************************************!
!* 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. 																															 *!
!*********************************************************************************************************************************************************!

*GET, mat_types, MAT, 0, COUNT
*GET, matid_max, MAT, 0, NUM, MAX

*IF, mat_types, NE, 0, THEN

	*DO, matid, 1, matid_max
	
		exit_flag = mpinqr(matid,0,1)
		exit_flat_MTID%matid% = exit_flag
		
		*IF, exit_flag, EQ, 1, THEN
	
			*get, e2,     eX, matid
			*get, pr23, PRXY, matid
			*get, rou,  DENS, matid
	
			*IF, e2, NE, 7.888609052E-31, THEN   ! not anisotropic material 
	
					*get, e3, eY, matid
					*get, e1, eZ, matid
	
				*IF, e1, EQ, 7.888609052E-31, AND, e3, EQ, 7.888609052E-31, THEN   ! isotropic material 
	
						orth_MTID%matid% = 0
						E_MTID%matid%    = e2
						niu_MTID%matid%  = pr23
						rou_MTID%matid%  = rou
						
					*ELSEIF, e1, NE, 7.888609052E-31, AND, e3, NE, 7.888609052E-31  ! orthotropic material 
				
						*get, g12, GXZ,   matid
						*get, g23, GXY,   matid
						*get, g13, GYZ,   matid
						*get, pr12, PRXZ, matid
						*get, pr13, PRYZ, matid
	
						orth_MTID%matid%    = 1
						E1_MTID%matid%      = e1
						E2_MTID%matid%      = e2
						E3_MTID%matid%      = e3
						G12_MTID%matid%     = g12
						G13_MTID%matid%     = g13
						G23_MTID%matid%     = g23
						niu12_MTID%matid%   = pr12
						niu13_MTID%matid%   = pr13
						niu23_MTID%matid%   = pr23
						rou_MTID%matid%     = rou
				
					*ELSE
				*ENDIF
			
			
			*ELSEIF, e2, EQ, 7.888609052E-31            ! anisotropic material 
			
					orth_MTID%matid% = 2
					*GET, D11, ANEL, matid, , , CONST, 1
					*GET, D12, ANEL, matid, , , CONST, 2
					*GET, D13, ANEL, matid, , , CONST, 3
					*GET, D14, ANEL, matid, , , CONST, 4
					*GET, D15, ANEL, matid, , , CONST, 5
					*GET, D16, ANEL, matid, , , CONST, 6
					*GET, D22, ANEL, matid, , , CONST, 7
					*GET, D23, ANEL, matid, , , CONST, 8
					*GET, D24, ANEL, matid, , , CONST, 9
					*GET, D25, ANEL, matid, , , CONST, 10
					*GET, D26, ANEL, matid, , , CONST, 11
					*GET, D33, ANEL, matid, , , CONST, 12
					*GET, D34, ANEL, matid, , , CONST, 13
					*GET, D35, ANEL, matid, , , CONST, 14
					*GET, D36, ANEL, matid, , , CONST, 15
					*GET, D44, ANEL, matid, , , CONST, 16
					*GET, D45, ANEL, matid, , , CONST, 17
					*GET, D46, ANEL, matid, , , CONST, 18
					*GET, D55, ANEL, matid, , , CONST, 19
					*GET, D56, ANEL, matid, , , CONST, 20
					*GET, D66, ANEL, matid, , , CONST, 21

					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c11_MTID%matid% = D11
					c12_MTID%matid% = D12
					c13_MTID%matid% = D13
					c14_MTID%matid% = D14
					c15_MTID%matid% = D15
					c16_MTID%matid% = D16
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c22_MTID%matid%	= D22
					c23_MTID%matid%	= D23
					c24_MTID%matid%	= D24
					c25_MTID%matid%	= D25
					c26_MTID%matid%	= D26
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c33_MTID%matid% = D33
					c34_MTID%matid% = D34
					c35_MTID%matid% = D35
					c36_MTID%matid% = D36
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c44_MTID%matid% = D44
					c45_MTID%matid% = D45
					c46_MTID%matid% = D46
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c55_MTID%matid% = D55
					c56_MTID%matid% = D56
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					c66_MTID%matid% = D66
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
					rou_MTID%matid% = rou
					!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
			
			*ELSE
			*ENDIF
	
	
		*ENDIF
	
	*ENDDO

*ENDIF