Ignore:
Timestamp:
06/03/13 11:21:19 (11 years ago)
Author:
ymipsl
Message:

Enhancement : Add fortran interface to know if an attribute is set or not
ex : CALL xios_is_defined_field_attr("field_A",enabled=ok)

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute_map.cpp

    r369 r432  
    191191         { 
    192192           it->second->generateCInterface(oss,className) ; 
     193           it->second->generateCInterfaceIsDefined(oss,className) ; 
    193194           oss<<iendl<<iendl ; 
    194195         } 
     
    201202         { 
    202203           it->second->generateFortran2003Interface(oss,className) ; 
     204           it->second->generateFortran2003InterfaceIsDefined(oss,className) ; 
     205           
    203206           oss<<iendl<<iendl ; 
    204207         } 
     
    299302         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl_)"<<iendl ; 
    300303          
    301       }       
     304      }      
     305       
     306 
     307      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) 
     308      { 
     309         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)   &"<<iendl++ ; 
     310         ostringstream* oss2 ; 
     311         SuperClassMap::const_iterator it ; 
     312         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     313          
     314         oss2=new ostringstream ; 
     315          
     316         *oss2<<"( "<<className<<"_hdl"  ; 
     317          
     318         for ( it=begin ; it != end; it++)  
     319         { 
     320           *oss2<<", "<<it->second->getName()<<"_" ; 
     321           if (oss2->str().size()>90)  
     322           { 
     323             oss<<oss2->str()<<"  &"<<iendl ; 
     324             delete oss2 ; 
     325             oss2=new ostringstream ; 
     326           } 
     327         } 
     328         *oss2<<" )" ; 
     329         oss<<oss2->str()<<iendl ; 
     330         oss<<iendl ; 
     331         delete oss2 ;  
     332          
     333         oss<<"IMPLICIT NONE"<<iendl++ ; 
     334         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
     335          
     336         for (it=begin; it != end; it++) 
     337         { 
     338           it->second->generateFortranInterfaceIsDefinedDeclaration_(oss,className) ; 
     339         } 
     340          
     341         oss<<iendl ; 
     342          
     343         for (it=begin; it != end; it++) 
     344         { 
     345           it->second->generateFortranInterfaceIsDefinedBody_(oss,className) ; 
     346           oss<<iendl ; 
     347         } 
     348          
     349         oss<<iendl--<<iendl-- ; 
     350         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)"<<iendl ; 
     351          
     352      }       
     353        
    302354 
    303355      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className) 
     
    413465         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl)"<<iendl ; 
    414466      }       
     467 
     468 
     469      void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className) 
     470      { 
     471         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)  &"<<iendl++ ; 
     472         ostringstream* oss2 ; 
     473         SuperClassMap::const_iterator it ; 
     474         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     475          
     476         oss2=new ostringstream ; 
     477         *oss2<<"( "<<className<<"_hdl"  ; 
     478         for ( it=begin ; it != end; it++)  
     479         { 
     480           *oss2<<", "<<it->second->getName() ; 
     481           if (oss2->str().size()>90)  
     482           { 
     483             oss<<oss2->str()<<"  &"<<iendl ; 
     484             delete oss2 ; 
     485             oss2=new ostringstream ; 
     486           } 
     487         } 
     488         *oss2<<" )" ; 
     489         oss<<oss2->str()<<iendl ; 
     490         oss<<iendl ; 
     491         delete oss2 ;  
     492         oss2=new ostringstream ; 
     493          
     494         oss<<"IMPLICIT NONE"<<iendl++ ; 
     495         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
     496          
     497         for (it=begin; it != end; it++) 
     498         { 
     499           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ; 
     500         } 
     501          
     502         oss<<iendl ; 
     503          
     504         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)  &"<<iendl ; 
     505          
     506         *oss2<<"( "<<className<<"_hdl"  ; 
     507         for ( it=begin ; it != end; it++)  
     508         { 
     509           *oss2<<", "<<it->second->getName() ; 
     510           if (oss2->str().size()>90)  
     511           { 
     512             oss<<oss2->str()<<"  &"<<iendl ; 
     513             delete oss2 ; 
     514             oss2=new ostringstream ; 
     515           } 
     516         } 
     517         *oss2<<" )" ; 
     518         oss<<oss2->str() ; 
     519         delete oss2 ;  
     520          
     521         oss<<iendl--<<iendl-- ; 
     522         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)"<<iendl ; 
     523      }       
     524 
    415525       
    416526      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className) 
     
    529639          
    530640      }       
     641       
     642      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) 
     643      { 
     644         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr)  &"<<iendl++ ; 
     645         ostringstream* oss2 ; 
     646         SuperClassMap::const_iterator it ; 
     647         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     648          
     649         oss2=new ostringstream ; 
     650         *oss2<<"( "<<className<<"_id"  ; 
     651         for ( it=begin ; it != end; it++)  
     652         { 
     653           *oss2<<", "<<it->second->getName() ; 
     654           if (oss2->str().size()>90)  
     655           { 
     656             oss<<oss2->str()<<"  &"<<iendl ; 
     657             delete oss2 ; 
     658             oss2=new ostringstream ; 
     659           } 
     660         } 
     661         *oss2<<" )" ; 
     662         oss<<oss2->str()<<iendl ; 
     663         oss<<iendl ; 
     664         delete oss2 ;  
     665         oss2=new ostringstream ; 
     666          
     667         oss<<"IMPLICIT NONE"<<iendl++ ; 
     668 
     669         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ; 
     670         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 
     671          
     672         for (it=begin; it != end; it++) 
     673         { 
     674           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ; 
     675         } 
     676          
     677         oss<<iendl ; 
     678         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ;  
     679         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)   &"<<iendl ; 
     680         *oss2<<"( "<<className<<"_hdl"  ; 
     681         for ( it=begin ; it != end; it++)  
     682         { 
     683           *oss2<<", "<<it->second->getName() ; 
     684           if (oss2->str().size()>90)  
     685           { 
     686             oss<<oss2->str()<<"  &"<<iendl ; 
     687             delete oss2 ; 
     688             oss2=new ostringstream ; 
     689           } 
     690         } 
     691         *oss2<<" )" ; 
     692         oss<<oss2->str() ; 
     693         delete oss2 ;  
     694          
     695         oss<<iendl--<<iendl-- ; 
     696         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr)"<<iendl ; 
     697          
     698      }       
    531699      ///-------------------------------------------------------------- 
    532700   
Note: See TracChangeset for help on using the changeset viewer.