From dbf5ee84cb997febff4a10949c1bfa352e751188 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 20:14:08 +0200 Subject: [PATCH] better readable --- src/material.f90 | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 40d178540..7264738e5 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -111,6 +111,10 @@ subroutine parse() phases => config_material%get('phase') homogenizations => config_material%get('homogenization') + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') + #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) material_name_homogenization = getKeys(homogenizations) @@ -126,31 +130,20 @@ subroutine parse() end do homogenization_maxNconstituents = maxval(homogenization_Nconstituents) - allocate(counterPhase(phases%length),source=0) - allocate(counterHomogenization(homogenizations%length),source=0) - - allocate(material_homogenizationID(discretization_Ncells),source=0) - allocate(material_homogenizationEntry(discretization_Ncells),source=0) - - allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) + allocate(temp_ho(materials%length)) + allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) + allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + ! parse YAML structure select type(materials) class is(tList) - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - allocate(temp_ho(materials%length)) - allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) - allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) - item => materials%first do ma = 1, materials%length material => item%node @@ -175,12 +168,21 @@ subroutine parse() if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') item => item%next - end do end select + allocate(counterPhase(phases%length),source=0) + allocate(counterHomogenization(homogenizations%length),source=0) + + allocate(material_homogenizationID(discretization_Ncells),source=0) + allocate(material_homogenizationEntry(discretization_Ncells),source=0) + + allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) + allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) + + ! build mappings do el = 1, discretization_Nelems @@ -212,6 +214,7 @@ subroutine parse() end subroutine parse + #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran