[313] | 1 | #ifndef __XIOS_GENERATE_INTERFACE_IMPL_HPP__ |
---|
| 2 | #define __XIOS_GENERATE_INTERFACE_IMPL_HPP__ |
---|
| 3 | |
---|
[591] | 4 | #include "xios_spl.hpp" |
---|
[313] | 5 | #include "generate_interface.hpp" |
---|
| 6 | #include "type_util.hpp" |
---|
| 7 | #include "indent.hpp" |
---|
[369] | 8 | #include "enum.hpp" |
---|
| 9 | #include "array_new.hpp" |
---|
[532] | 10 | #include "date.hpp" |
---|
[313] | 11 | |
---|
[335] | 12 | namespace xios |
---|
[509] | 13 | { |
---|
[581] | 14 | template<> string CInterface::getStrFortranType<int>(void) { return string("INTEGER"); } |
---|
| 15 | template<> string CInterface::getStrFortranType<bool>(void) { return string("LOGICAL"); } |
---|
| 16 | template<> string CInterface::getStrFortranType<double>(void) { return string("REAL"); } |
---|
| 17 | template<> string CInterface::getStrFortranType<float>(void) { return string("REAL"); } |
---|
| 18 | template<> string CInterface::getStrFortranType<CDate>(void) { return string("TYPE(txios(date))"); } |
---|
| 19 | template<> string CInterface::getStrFortranType<CDuration>(void) { return string("TYPE(txios(duration))"); } |
---|
[509] | 20 | |
---|
[581] | 21 | template<> string CInterface::getStrFortranKind<int>(void) { return string(""); } |
---|
| 22 | template<> string CInterface::getStrFortranKind<bool>(void) { return string(""); } |
---|
| 23 | template<> string CInterface::getStrFortranKind<double>(void) { return string("(KIND=8)"); } |
---|
| 24 | template<> string CInterface::getStrFortranKind<float>(void) { return string("(KIND=4)"); } |
---|
| 25 | template<> string CInterface::getStrFortranKind<CDate>(void) { return string(""); } |
---|
| 26 | template<> string CInterface::getStrFortranKind<CDuration>(void) { return string(""); } |
---|
[509] | 27 | |
---|
[581] | 28 | template<> string CInterface::getStrFortranKindC<int>(void) { return string("(KIND=C_INT)"); } |
---|
| 29 | template<> string CInterface::getStrFortranKindC<bool>(void) { return string("(KIND=C_BOOL)"); } |
---|
| 30 | template<> string CInterface::getStrFortranKindC<double>(void) { return string("(KIND=C_DOUBLE)"); } |
---|
| 31 | template<> string CInterface::getStrFortranKindC<float>(void) { return string("(KIND=C_FLOAT)"); } |
---|
| 32 | template<> string CInterface::getStrFortranKindC<CDate>(void) { return string(""); } |
---|
| 33 | template<> string CInterface::getStrFortranKindC<CDuration>(void) { return string(""); } |
---|
[509] | 34 | |
---|
[581] | 35 | template<> bool CInterface::matchingTypeCFortran<int>(void) { return true; } |
---|
| 36 | template<> bool CInterface::matchingTypeCFortran<bool>(void) { return false; } |
---|
[352] | 37 | template<> bool CInterface::matchingTypeCFortran<double>(void) { return true; } |
---|
| 38 | template<> bool CInterface::matchingTypeCFortran<float>(void) { return true; } |
---|
[532] | 39 | template<> bool CInterface::matchingTypeCFortran<CDate>(void) { return true; } |
---|
[537] | 40 | template<> bool CInterface::matchingTypeCFortran<CDuration>(void) { return true; } |
---|
[313] | 41 | |
---|
| 42 | // ///////////////////////////////////////////////// |
---|
| 43 | // // C Interface // |
---|
| 44 | // ///////////////////////////////////////////////// |
---|
| 45 | |
---|
[581] | 46 | void CInterface::AttributeIsDefinedCInterface(ostream& oss, const string& className, const string& name) |
---|
[432] | 47 | { |
---|
[581] | 48 | oss << "bool cxios_is_defined_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl)" << iendl; |
---|
| 49 | oss << "{" << iendl; |
---|
| 50 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 51 | oss << " bool isDefined = " << className << "_hdl->" << name << ".hasInheritedValue();" << iendl; |
---|
| 52 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 53 | oss << " return isDefined;" << iendl; |
---|
| 54 | oss << "}" << std::endl; |
---|
[432] | 55 | } |
---|
[509] | 56 | |
---|
[313] | 57 | template <class T> |
---|
[581] | 58 | void CInterface::AttributeCInterface(ostream& oss, const string& className, const string& name) |
---|
[313] | 59 | { |
---|
[581] | 60 | string typeName = getStrType<T>(); |
---|
[509] | 61 | |
---|
[581] | 62 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << " " << name << ")" << iendl; |
---|
| 63 | oss << "{" << iendl; |
---|
| 64 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 65 | oss << " " << className << "_hdl->" << name << ".setValue(" << name << ");" << iendl; |
---|
| 66 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 67 | oss << "}" << std::endl; |
---|
[509] | 68 | |
---|
[581] | 69 | oss << iendl; |
---|
| 70 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ")" << iendl; |
---|
| 71 | oss << "{" << iendl; |
---|
| 72 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 73 | oss << " *" << name << " = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; |
---|
| 74 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 75 | oss << "}" << std::endl; |
---|
[313] | 76 | } |
---|
[509] | 77 | |
---|
[313] | 78 | template<> |
---|
[581] | 79 | void CInterface::AttributeCInterface<string>(ostream& oss, const string& className, const string& name) |
---|
[313] | 80 | { |
---|
[581] | 81 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, const char * " << name << ", int " << name << "_size)" << iendl; |
---|
| 82 | oss << "{" << iendl; |
---|
| 83 | oss << " std::string " << name << "_str;" << iendl; |
---|
| 84 | oss << " if (!cstr2string(" << name << ", " << name << "_size, " << name << "_str)) return;" << iendl; |
---|
| 85 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 86 | oss << " " << className << "_hdl->" << name << ".setValue(" << name << "_str);" << iendl; |
---|
| 87 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 88 | oss << "}" << std::endl; |
---|
[509] | 89 | |
---|
[581] | 90 | oss << iendl; |
---|
[509] | 91 | |
---|
[581] | 92 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, char * " << name << ", int " << name << "_size)" << iendl; |
---|
| 93 | oss << "{" << iendl; |
---|
| 94 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 95 | oss << " if (!string_copy(" << className << "_hdl->" << name << ".getInheritedValue(), " << name << ", " << name << "_size))" << iendl; |
---|
| 96 | oss << " ERROR(\"void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, char * " << name << ", int " |
---|
[672] | 97 | << name << "_size)\", << \"Input string is too short\");" << iendl; |
---|
[581] | 98 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 99 | oss << "}" << std::endl; |
---|
[313] | 100 | } |
---|
| 101 | |
---|
[369] | 102 | template<> |
---|
[581] | 103 | void CInterface::AttributeCInterface<CEnumBase>(ostream& oss, const string& className, const string& name) |
---|
[369] | 104 | { |
---|
[581] | 105 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, const char * " << name << ", int " << name << "_size)" << iendl; |
---|
| 106 | oss << "{" << iendl; |
---|
| 107 | oss << " std::string " << name << "_str;" << iendl; |
---|
| 108 | oss << " if (!cstr2string(" << name << ", " << name << "_size, " << name << "_str)) return;" << iendl; |
---|
| 109 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 110 | oss << " " << className << "_hdl->" << name << ".fromString(" << name << "_str);" << iendl; |
---|
| 111 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 112 | oss << "}" << std::endl; |
---|
[509] | 113 | |
---|
[581] | 114 | oss << iendl; |
---|
[509] | 115 | |
---|
[581] | 116 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, char * " << name << ", int " << name << "_size)" << iendl; |
---|
| 117 | oss << "{" << iendl; |
---|
| 118 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 119 | oss << " if (!string_copy(" << className << "_hdl->" << name << ".getInheritedStringValue(), " << name << ", " << name << "_size))" << iendl; |
---|
| 120 | oss << " ERROR(\"void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, char * " << name << ", int " |
---|
[672] | 121 | << name << "_size)\", << \"Input string is too short\");" << iendl; |
---|
[581] | 122 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
| 123 | oss << "}" << std::endl; |
---|
[369] | 124 | } |
---|
[313] | 125 | |
---|
[532] | 126 | template<> |
---|
[581] | 127 | void CInterface::AttributeCInterface<CDate>(ostream& oss, const string& className, const string& name) |
---|
[532] | 128 | { |
---|
| 129 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_date " << name << "_c)" << iendl; |
---|
| 130 | oss << "{" << iendl; |
---|
| 131 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 132 | oss << " " << className << "_hdl->" << name << ".allocate();" << iendl; |
---|
[581] | 133 | oss << " CDate& " << name << " = " << className << "_hdl->" << name << ".get();" << iendl; |
---|
[532] | 134 | oss << " " << name << ".setDate(" << name << "_c.year," << iendl; |
---|
| 135 | oss << " " << name << "_c.month," << iendl; |
---|
| 136 | oss << " " << name << "_c.day," << iendl; |
---|
| 137 | oss << " " << name << "_c.hour," << iendl; |
---|
| 138 | oss << " " << name << "_c.minute," << iendl; |
---|
| 139 | oss << " " << name << "_c.second);" << iendl; |
---|
| 140 | oss << " if (" << name << ".hasRelCalendar())" << iendl; |
---|
| 141 | oss << " " << name << ".checkDate();" << iendl; |
---|
| 142 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
[581] | 143 | oss << "}" << std::endl; |
---|
[532] | 144 | |
---|
| 145 | oss << iendl; |
---|
| 146 | |
---|
| 147 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_date* " << name << "_c)" << iendl; |
---|
| 148 | oss << "{" << iendl; |
---|
| 149 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
[581] | 150 | oss << " CDate " << name << " = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; |
---|
[532] | 151 | oss << " " << name << "_c->year = " << name << ".getYear();" << iendl; |
---|
| 152 | oss << " " << name << "_c->month = " << name << ".getMonth();" << iendl; |
---|
| 153 | oss << " " << name << "_c->day = " << name << ".getDay();" << iendl; |
---|
| 154 | oss << " " << name << "_c->hour = " << name << ".getHour();" << iendl; |
---|
| 155 | oss << " " << name << "_c->minute = " << name << ".getMinute();" << iendl; |
---|
| 156 | oss << " " << name << "_c->second = " << name << ".getSecond();" << iendl; |
---|
| 157 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
[581] | 158 | oss << "}" << std::endl; |
---|
[532] | 159 | } |
---|
| 160 | |
---|
[537] | 161 | template<> |
---|
[581] | 162 | void CInterface::AttributeCInterface<CDuration>(ostream& oss, const string& className, const string& name) |
---|
[537] | 163 | { |
---|
| 164 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration " << name << "_c)" << iendl; |
---|
| 165 | oss << "{" << iendl; |
---|
| 166 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
| 167 | oss << " " << className << "_hdl->" << name << ".allocate();" << iendl; |
---|
[581] | 168 | oss << " CDuration& " << name << " = " << className << "_hdl->" << name << ".get();" << iendl; |
---|
[537] | 169 | oss << " " << name << ".year = " << name << "_c.year;" << iendl; |
---|
| 170 | oss << " " << name << ".month = " << name << "_c.month;" << iendl; |
---|
| 171 | oss << " " << name << ".day = " << name << "_c.day;" << iendl; |
---|
| 172 | oss << " " << name << ".hour = " << name << "_c.hour;" << iendl; |
---|
| 173 | oss << " " << name << ".minute = " << name << "_c.minute;" << iendl; |
---|
| 174 | oss << " " << name << ".second = " << name << "_c.second;" << iendl; |
---|
| 175 | oss << " " << name << ".timestep = " << name << "_c.timestep;" << iendl; |
---|
| 176 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
[581] | 177 | oss << "}" << std::endl; |
---|
[537] | 178 | |
---|
| 179 | oss << iendl; |
---|
| 180 | |
---|
| 181 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration* " << name << "_c)" << iendl; |
---|
| 182 | oss << "{" << iendl; |
---|
| 183 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; |
---|
[581] | 184 | oss << " CDuration " << name << " = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; |
---|
[537] | 185 | oss << " " << name << "_c->year = " << name << ".year;" << iendl; |
---|
| 186 | oss << " " << name << "_c->month = " << name << ".month;" << iendl; |
---|
| 187 | oss << " " << name << "_c->day = " << name << ".day;" << iendl; |
---|
| 188 | oss << " " << name << "_c->hour = " << name << ".hour;" << iendl; |
---|
| 189 | oss << " " << name << "_c->minute = " << name << ".minute;" << iendl; |
---|
| 190 | oss << " " << name << "_c->second = " << name << ".second;" << iendl; |
---|
| 191 | oss << " " << name << "_c->timestep = " << name << ".timestep;" << iendl; |
---|
| 192 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; |
---|
[581] | 193 | oss << "}" << std::endl; |
---|
[537] | 194 | } |
---|
| 195 | |
---|
[509] | 196 | #undef macro |
---|
[313] | 197 | |
---|
| 198 | // ///////////////////////////////////////////////// |
---|
| 199 | // // Fortran 2003 Interface // |
---|
| 200 | // ///////////////////////////////////////////////// |
---|
[509] | 201 | |
---|
[672] | 202 | void CInterface::AttributeIsDefinedFortran2003Interface(ostream& oss, const string& className, const string& name) |
---|
| 203 | { |
---|
| 204 | oss << "FUNCTION cxios_is_defined_" << className << "_" << name << "(" << className << "_hdl) BIND(C)" << iendl; |
---|
| 205 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 206 | oss << " LOGICAL(kind=C_BOOL) :: cxios_is_defined_" << className << "_" << name << iendl; |
---|
| 207 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 208 | oss << "END FUNCTION cxios_is_defined_" << className << "_" << name << std::endl; |
---|
| 209 | } |
---|
[509] | 210 | |
---|
[672] | 211 | template <class T> |
---|
| 212 | void CInterface::AttributeFortran2003Interface(ostream& oss, const string& className, const string& name) |
---|
| 213 | { |
---|
| 214 | string fortranType=getStrFortranType<T>(); |
---|
| 215 | string fortranKindC=getStrFortranKindC<T>(); |
---|
[509] | 216 | |
---|
[1636] | 217 | // oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 218 | int indent = oss.iword(iendl.index); |
---|
| 219 | string str = "SUBROUTINE cxios_set_" + className + "_" + name + "(" + className + "_hdl, " + name + ") BIND(C)"; |
---|
| 220 | if ((str.length() + indent) >132) |
---|
| 221 | { |
---|
| 222 | oss << str.substr(0,130-indent) ; |
---|
| 223 | oss << "&" << endl; |
---|
| 224 | oss << "&" << str.substr(130-indent,str.length()) ; |
---|
| 225 | } |
---|
| 226 | else |
---|
| 227 | { |
---|
| 228 | oss << str; |
---|
| 229 | } |
---|
| 230 | oss << iendl; |
---|
[672] | 231 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 232 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 233 | oss << " " << fortranType << " " << fortranKindC << " , VALUE :: " << name << iendl; |
---|
| 234 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
| 235 | oss << iendl; |
---|
| 236 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 237 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 238 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 239 | oss << " " << fortranType << " " << fortranKindC << " :: " << name << iendl; |
---|
| 240 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
| 241 | } |
---|
[369] | 242 | |
---|
[532] | 243 | template <> |
---|
[672] | 244 | void CInterface::AttributeFortran2003Interface<string>(ostream& oss, const string& className, const string& name) |
---|
| 245 | { |
---|
[1636] | 246 | // oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", " << name << "_size) BIND(C)" << iendl; |
---|
| 247 | int indent = oss.iword(iendl.index); |
---|
| 248 | string str ="SUBROUTINE cxios_set_" + className + "_" + name + "(" + className + "_hdl, " + name + ", " + name + "_size) BIND(C)"; |
---|
| 249 | if ((str.length() + indent) >132) |
---|
| 250 | { |
---|
| 251 | oss << str.substr(0,130-indent) ; |
---|
| 252 | oss << "&" << endl; |
---|
| 253 | oss << "&" << str.substr(130-indent,str.length()) ; |
---|
| 254 | } |
---|
| 255 | else |
---|
| 256 | { |
---|
| 257 | oss << str; |
---|
| 258 | } |
---|
| 259 | oss << iendl; |
---|
[672] | 260 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 261 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 262 | oss << " CHARACTER(kind = C_CHAR) , DIMENSION(*) :: " << name << iendl; |
---|
| 263 | oss << " INTEGER (kind = C_INT) , VALUE :: " << name << "_size" << iendl; |
---|
| 264 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
| 265 | oss << iendl; |
---|
[1636] | 266 | // oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", " << name << "_size) BIND(C)" << iendl; |
---|
| 267 | str = "SUBROUTINE cxios_get_" + className + "_" + name + "(" + className + "_hdl, " + name + ", " + name + "_size) BIND(C)"; |
---|
| 268 | if ((str.length() + indent) >132) |
---|
| 269 | { |
---|
| 270 | oss << str.substr(0,130-indent) ; |
---|
| 271 | oss << "&" << endl; |
---|
| 272 | oss << "&" << str.substr(130-indent,str.length()) ; |
---|
| 273 | } |
---|
| 274 | else |
---|
| 275 | { |
---|
| 276 | oss << str; |
---|
| 277 | } |
---|
| 278 | oss << iendl; |
---|
[672] | 279 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 280 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 281 | oss << " CHARACTER(kind = C_CHAR) , DIMENSION(*) :: " << name << iendl; |
---|
| 282 | oss << " INTEGER (kind = C_INT) , VALUE :: " << name << "_size" << iendl; |
---|
| 283 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | template <> |
---|
[1636] | 287 | void CInterface::AttributeFortran2003Interface<CDuration>(ostream& oss, const string& className, const string& name) |
---|
[532] | 288 | { |
---|
[1636] | 289 | // oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 290 | string str = "SUBROUTINE cxios_set_" + className + "_" + name + "(" + className + "_hdl, " + name + ") BIND(C)"; |
---|
| 291 | int indent = oss.iword(iendl.index); |
---|
| 292 | if ((str.length() + indent) >132) |
---|
| 293 | { |
---|
| 294 | oss << str.substr(0,130-indent) ; |
---|
| 295 | oss << "&" << endl; |
---|
| 296 | oss << "&" << str.substr(130-indent,str.length()) ; |
---|
| 297 | } |
---|
| 298 | else |
---|
| 299 | { |
---|
| 300 | oss << str; |
---|
| 301 | } |
---|
[532] | 302 | oss << iendl; |
---|
| 303 | oss << " USE ISO_C_BINDING" << iendl; |
---|
[545] | 304 | oss << " USE IDURATION" << iendl; |
---|
[537] | 305 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 306 | oss << " TYPE(txios(duration)), VALUE :: " << name << iendl; |
---|
[581] | 307 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
[537] | 308 | oss << iendl; |
---|
| 309 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 310 | oss << " USE ISO_C_BINDING" << iendl; |
---|
[545] | 311 | oss << " USE IDURATION" << iendl; |
---|
[537] | 312 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 313 | oss << " TYPE(txios(duration)) :: " << name << iendl; |
---|
[581] | 314 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
[537] | 315 | } |
---|
| 316 | |
---|
[672] | 317 | template <class T> |
---|
| 318 | void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 319 | { |
---|
| 320 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name; |
---|
| 321 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " :: " << name << "_tmp"; |
---|
| 322 | } |
---|
[509] | 323 | |
---|
[672] | 324 | template <class T> |
---|
| 325 | void CInterface::AttributeFortranInterfaceGetDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 326 | { |
---|
| 327 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name; |
---|
| 328 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " :: " << name << "_tmp"; |
---|
| 329 | } |
---|
[369] | 330 | |
---|
[672] | 331 | void CInterface::AttributeFortranInterfaceIsDefinedDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 332 | { |
---|
| 333 | oss << "LOGICAL, OPTIONAL, INTENT(OUT) :: " << name << iendl; |
---|
| 334 | oss << "LOGICAL(KIND=C_BOOL) :: " << name << "_tmp"; |
---|
| 335 | } |
---|
[313] | 336 | |
---|
[672] | 337 | template <> |
---|
| 338 | void CInterface::AttributeFortranInterfaceDeclaration<string>(ostream& oss, const string& className, const string& name) |
---|
| 339 | { |
---|
| 340 | oss << "CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: " << name; |
---|
| 341 | } |
---|
[509] | 342 | |
---|
[672] | 343 | template <> |
---|
| 344 | void CInterface::AttributeFortranInterfaceGetDeclaration<string>(ostream& oss, const string& className, const string& name) |
---|
| 345 | { |
---|
| 346 | oss << "CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: " << name; |
---|
| 347 | } |
---|
[509] | 348 | |
---|
[672] | 349 | template <class T> |
---|
| 350 | void CInterface::AttributeFortranInterfaceBody(ostream& oss, const string& className, const string& name) |
---|
| 351 | { |
---|
| 352 | string name_tmp=name+"__tmp"; |
---|
[509] | 353 | |
---|
[672] | 354 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
| 355 | if (!matchingTypeCFortran<T>()) |
---|
| 356 | { |
---|
| 357 | oss << " " << name_tmp << " = " << name << "_" << iendl; |
---|
[966] | 358 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 359 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ")" << iendl; |
---|
[672] | 360 | } |
---|
[966] | 361 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 362 | oss << "(" << className << "_hdl%daddr, " << name << "_)" << iendl; } |
---|
[672] | 363 | oss << "ENDIF"; |
---|
| 364 | } |
---|
[313] | 365 | |
---|
[672] | 366 | template <class T> |
---|
| 367 | void CInterface::AttributeFortranInterfaceGetBody(ostream& oss, const string& className, const string& name) |
---|
| 368 | { |
---|
| 369 | string name_tmp=name+"__tmp"; |
---|
[509] | 370 | |
---|
[672] | 371 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
| 372 | if (!matchingTypeCFortran<T>()) |
---|
| 373 | { |
---|
[966] | 374 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 375 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ")" << iendl; |
---|
[672] | 376 | oss << " " << name << "_ = " << name_tmp << iendl; |
---|
| 377 | } |
---|
[966] | 378 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 379 | oss << "(" << className << "_hdl%daddr, " << name << "_)" << iendl; } |
---|
[672] | 380 | oss << "ENDIF"; |
---|
| 381 | } |
---|
[313] | 382 | |
---|
[672] | 383 | void CInterface::AttributeFortranInterfaceIsDefinedBody(ostream& oss, const string& className, const string& name) |
---|
| 384 | { |
---|
| 385 | string name_tmp=name+"__tmp"; |
---|
[509] | 386 | |
---|
[672] | 387 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
[966] | 388 | oss << " " << name << "__tmp = cxios_is_defined_" << className << "_" << name << " &" << iendl; |
---|
| 389 | oss << "(" << className << "_hdl%daddr)" << iendl; |
---|
[672] | 390 | oss << " " << name << "_ = " << name_tmp << iendl; |
---|
| 391 | oss << "ENDIF"; |
---|
| 392 | } |
---|
[509] | 393 | |
---|
[672] | 394 | template <> |
---|
| 395 | void CInterface::AttributeFortranInterfaceBody<string>(ostream& oss, const string& className, const string& name) |
---|
| 396 | { |
---|
| 397 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
[966] | 398 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 399 | oss << "(" << className << "_hdl%daddr, " << name << "_, len(" << name << "_))" << iendl; |
---|
[672] | 400 | oss << "ENDIF"; |
---|
| 401 | } |
---|
[509] | 402 | |
---|
[672] | 403 | template <> |
---|
| 404 | void CInterface::AttributeFortranInterfaceGetBody<string>(ostream& oss, const string& className, const string& name) |
---|
| 405 | { |
---|
| 406 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
[966] | 407 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 408 | oss << "(" << className << "_hdl%daddr, " << name << "_, len(" << name << "_))" << iendl; |
---|
[672] | 409 | oss << "ENDIF"; |
---|
| 410 | } |
---|
[509] | 411 | |
---|
[369] | 412 | // declaration for CArray |
---|
| 413 | |
---|
| 414 | #define macro(T) \ |
---|
[581] | 415 | template <> \ |
---|
| 416 | void CInterface::AttributeCInterface<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 417 | { \ |
---|
| 418 | string typeName=getStrType<T>(); \ |
---|
[369] | 419 | \ |
---|
[674] | 420 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 421 | oss << "{" << iendl; \ |
---|
| 422 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 423 | oss << " CArray<" << typeName << ",1> tmp(" << name << ", shape(extent[0]), neverDeleteData);" << iendl; \ |
---|
[581] | 424 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 425 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 426 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 427 | oss << "}" << std::endl; \ |
---|
| 428 | oss << iendl; \ |
---|
[674] | 429 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 430 | oss << "{" << iendl; \ |
---|
| 431 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 432 | oss << " CArray<" << typeName << ",1> tmp(" << name << ", shape(extent[0]), neverDeleteData);" << iendl; \ |
---|
[581] | 433 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 434 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 435 | oss << "}" << std::endl; \ |
---|
| 436 | } \ |
---|
[369] | 437 | \ |
---|
| 438 | template <> \ |
---|
[581] | 439 | void CInterface::AttributeCInterface<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 440 | { \ |
---|
| 441 | string typeName=getStrType<T>(); \ |
---|
[369] | 442 | \ |
---|
[674] | 443 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 444 | oss << "{" << iendl; \ |
---|
| 445 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 446 | oss << " CArray<" << typeName << ",2> tmp(" << name << ", shape(extent[0], extent[1]), neverDeleteData);" << iendl; \ |
---|
[581] | 447 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 448 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 449 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 450 | oss << "}" << std::endl; \ |
---|
| 451 | oss << iendl; \ |
---|
[674] | 452 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 453 | oss << "{" << iendl; \ |
---|
| 454 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 455 | oss << " CArray<" << typeName << ",2> tmp(" << name << ", shape(extent[0], extent[1]), neverDeleteData);" << iendl; \ |
---|
[581] | 456 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 457 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 458 | oss << "}" << std::endl; \ |
---|
| 459 | } \ |
---|
[369] | 460 | \ |
---|
[581] | 461 | template <> \ |
---|
| 462 | void CInterface::AttributeCInterface<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 463 | { \ |
---|
| 464 | string typeName=getStrType<T>(); \ |
---|
[369] | 465 | \ |
---|
[674] | 466 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 467 | oss << "{" << iendl; \ |
---|
| 468 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 469 | oss << " CArray<" << typeName << ",3> tmp(" << name << ", shape(extent[0], extent[1], extent[2]), neverDeleteData);" << iendl; \ |
---|
[581] | 470 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 471 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 472 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 473 | oss << "}" << std::endl; \ |
---|
| 474 | oss << iendl; \ |
---|
[674] | 475 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 476 | oss << "{" << iendl; \ |
---|
| 477 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 478 | oss << " CArray<" << typeName << ",3> tmp(" << name << ", shape(extent[0], extent[1], extent[2]), neverDeleteData);" << iendl; \ |
---|
[581] | 479 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 480 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 481 | oss << "}" << std::endl; \ |
---|
[932] | 482 | } \ |
---|
| 483 | \ |
---|
| 484 | template <> \ |
---|
| 485 | void CInterface::AttributeCInterface<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 486 | { \ |
---|
| 487 | string typeName=getStrType<T>(); \ |
---|
| 488 | \ |
---|
| 489 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 490 | oss << "{" << iendl; \ |
---|
| 491 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 492 | oss << " CArray<" << typeName << ",4> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3]), neverDeleteData);" << iendl; \ |
---|
| 493 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 494 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 495 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 496 | oss << "}" << std::endl; \ |
---|
| 497 | oss << iendl; \ |
---|
| 498 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 499 | oss << "{" << iendl; \ |
---|
| 500 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 501 | oss << " CArray<" << typeName << ",4> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3]), neverDeleteData);" << iendl; \ |
---|
| 502 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 503 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 504 | oss << "}" << std::endl; \ |
---|
| 505 | } \ |
---|
| 506 | \ |
---|
| 507 | template <> \ |
---|
| 508 | void CInterface::AttributeCInterface<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 509 | { \ |
---|
| 510 | string typeName=getStrType<T>(); \ |
---|
| 511 | \ |
---|
| 512 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 513 | oss << "{" << iendl; \ |
---|
| 514 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 515 | oss << " CArray<" << typeName << ",5> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4]), neverDeleteData);" << iendl; \ |
---|
| 516 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 517 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 518 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 519 | oss << "}" << std::endl; \ |
---|
| 520 | oss << iendl; \ |
---|
| 521 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 522 | oss << "{" << iendl; \ |
---|
| 523 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 524 | oss << " CArray<" << typeName << ",5> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4]), neverDeleteData);" << iendl; \ |
---|
| 525 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 526 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 527 | oss << "}" << std::endl; \ |
---|
| 528 | } \ |
---|
| 529 | \ |
---|
| 530 | template <> \ |
---|
| 531 | void CInterface::AttributeCInterface<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 532 | { \ |
---|
| 533 | string typeName=getStrType<T>(); \ |
---|
| 534 | \ |
---|
| 535 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 536 | oss << "{" << iendl; \ |
---|
| 537 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 538 | oss << " CArray<" << typeName << ",6> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]), neverDeleteData);" << iendl; \ |
---|
| 539 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 540 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 541 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 542 | oss << "}" << std::endl; \ |
---|
| 543 | oss << iendl; \ |
---|
| 544 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 545 | oss << "{" << iendl; \ |
---|
| 546 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 547 | oss << " CArray<" << typeName << ",6> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]), neverDeleteData);" << iendl; \ |
---|
| 548 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 549 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 550 | oss << "}" << std::endl; \ |
---|
| 551 | } \ |
---|
| 552 | \ |
---|
| 553 | template <> \ |
---|
| 554 | void CInterface::AttributeCInterface<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 555 | { \ |
---|
| 556 | string typeName=getStrType<T>(); \ |
---|
| 557 | \ |
---|
| 558 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 559 | oss << "{" << iendl; \ |
---|
| 560 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 561 | oss << " CArray<" << typeName << ",7> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5], extent[6]), neverDeleteData);" << iendl; \ |
---|
| 562 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 563 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 564 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 565 | oss << "}" << std::endl; \ |
---|
| 566 | oss << iendl; \ |
---|
| 567 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 568 | oss << "{" << iendl; \ |
---|
| 569 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 570 | oss << " CArray<" << typeName << ",7> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5], extent[6]), neverDeleteData);" << iendl; \ |
---|
| 571 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 572 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 573 | oss << "}" << std::endl; \ |
---|
[369] | 574 | } |
---|
| 575 | |
---|
| 576 | macro(bool) |
---|
| 577 | macro(double) |
---|
| 578 | macro(int) |
---|
| 579 | |
---|
[509] | 580 | #undef macro |
---|
[369] | 581 | |
---|
[1158] | 582 | #define macro(N,EXTENT)\ |
---|
| 583 | template <>\ |
---|
| 584 | void CInterface::AttributeCInterface<CArray<StdString,N> >(ostream& oss, const string& className, const string& name)\ |
---|
| 585 | { \ |
---|
| 586 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << "char* " << name <<", int str_len, int* str_size, int* extent)" << iendl; \ |
---|
| 587 | oss << "{" << iendl; \ |
---|
| 588 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 589 | oss << " "<<className<<"_hdl->"<<name<<".resize(shape("<<EXTENT<<"));"<<iendl;\ |
---|
| 590 | oss << " Array<StdString,"<<#N<<">::iterator it, itb="<<className<<"_hdl->"<<name<<".begin(), ite="<<className<<"_hdl->"<<name<<".end() ;"<<iendl ;\ |
---|
| 591 | oss << " int i, n ;"<< iendl; \ |
---|
| 592 | oss << " for(it=itb, i=0, n=0 ; it!=ite ; ++it,n+=str_len,++i) *it=StdString(&"<<name<<"[n],str_size[i]) ;"<<iendl ;\ |
---|
| 593 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 594 | oss << "}" << std::endl; \ |
---|
| 595 | oss << iendl; \ |
---|
| 596 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << "char* " << name << ", int str_size, int* extent)" << iendl; \ |
---|
| 597 | oss << "{" << iendl; \ |
---|
| 598 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 599 | oss << " Array<StdString,"<<#N<<">::const_iterator it, itb="<<className<<"_hdl->"<<name<<".getInheritedValue().begin(), ite="<<className<<"_hdl->"<<name<<".getInheritedValue().end() ;" << iendl; \ |
---|
| 600 | oss << " int n ;"<< iendl; \ |
---|
| 601 | oss << " for(it=itb, n=0 ; it!=ite ; ++it, n+=str_size) it->copy(&"<<name<<"[n],it->size()) ; "<< iendl; \ |
---|
| 602 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 603 | oss << "}" << std::endl; \ |
---|
| 604 | } |
---|
| 605 | |
---|
| 606 | macro(1,"extent[0]") |
---|
| 607 | macro(2,"extent[0],extent[1]") |
---|
| 608 | macro(3,"extent[0],extent[1],extent[2]") |
---|
| 609 | macro(4,"extent[0],extent[1],extent[2],extent[3]") |
---|
| 610 | macro(5,"extent[0],extent[1],extent[2],extent[3],extent[4]") |
---|
| 611 | macro(6,"extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]") |
---|
| 612 | macro(7,"extent[0],extent[1],extent[2],extent[3],extent[4],extent[5],extent[6]") |
---|
| 613 | #undef macro |
---|
[369] | 614 | // ///////////////////////////////////////////////// |
---|
| 615 | // // Fortran 2003 Interface // |
---|
| 616 | // ///////////////////////////////////////////////// |
---|
| 617 | |
---|
[581] | 618 | #define macro(T) \ |
---|
[672] | 619 | template <> \ |
---|
| 620 | void CInterface::AttributeFortran2003Interface<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 621 | { \ |
---|
| 622 | string fortranType=getStrFortranType<T>(); \ |
---|
| 623 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 624 | \ |
---|
[674] | 625 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 626 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 627 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 628 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 629 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 630 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 631 | oss << iendl; \ |
---|
[674] | 632 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 633 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 634 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 635 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 636 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 637 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 638 | } \ |
---|
[369] | 639 | \ |
---|
[672] | 640 | template <> \ |
---|
| 641 | void CInterface::AttributeFortran2003Interface<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 642 | { \ |
---|
| 643 | string fortranType=getStrFortranType<T>(); \ |
---|
| 644 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 645 | \ |
---|
[674] | 646 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 647 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 648 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 649 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 650 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 651 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 652 | oss << iendl; \ |
---|
[674] | 653 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 654 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 655 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 656 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 657 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 658 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 659 | } \ |
---|
[932] | 660 | \ |
---|
[672] | 661 | template <> \ |
---|
| 662 | void CInterface::AttributeFortran2003Interface<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 663 | { \ |
---|
| 664 | string fortranType=getStrFortranType<T>(); \ |
---|
| 665 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 666 | \ |
---|
[674] | 667 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 668 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 669 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 670 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 671 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 672 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 673 | oss << iendl; \ |
---|
[674] | 674 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 675 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 676 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 677 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 678 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 679 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
[932] | 680 | } \ |
---|
| 681 | \ |
---|
| 682 | template <> \ |
---|
| 683 | void CInterface::AttributeFortran2003Interface<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 684 | { \ |
---|
| 685 | string fortranType=getStrFortranType<T>(); \ |
---|
| 686 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 687 | \ |
---|
| 688 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 689 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 690 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 691 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 692 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 693 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 694 | oss << iendl; \ |
---|
| 695 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 696 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 697 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 698 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 699 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 700 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 701 | }\ |
---|
| 702 | \ |
---|
| 703 | template <> \ |
---|
| 704 | void CInterface::AttributeFortran2003Interface<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 705 | { \ |
---|
| 706 | string fortranType=getStrFortranType<T>(); \ |
---|
| 707 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 708 | \ |
---|
| 709 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 710 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 711 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 712 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 713 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 714 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 715 | oss << iendl; \ |
---|
| 716 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 717 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 718 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 719 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 720 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 721 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 722 | }\ |
---|
| 723 | \ |
---|
| 724 | template <> \ |
---|
| 725 | void CInterface::AttributeFortran2003Interface<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 726 | { \ |
---|
| 727 | string fortranType=getStrFortranType<T>(); \ |
---|
| 728 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 729 | \ |
---|
| 730 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 731 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 732 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 733 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 734 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 735 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 736 | oss << iendl; \ |
---|
| 737 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 738 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 739 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 740 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 741 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 742 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 743 | }\ |
---|
| 744 | \ |
---|
| 745 | template <> \ |
---|
| 746 | void CInterface::AttributeFortran2003Interface<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 747 | { \ |
---|
| 748 | string fortranType=getStrFortranType<T>(); \ |
---|
| 749 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 750 | \ |
---|
| 751 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 752 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 753 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 754 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 755 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 756 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 757 | oss << iendl; \ |
---|
| 758 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 759 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 760 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 761 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 762 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 763 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
[672] | 764 | } |
---|
[509] | 765 | |
---|
[369] | 766 | macro(bool) |
---|
| 767 | macro(double) |
---|
| 768 | macro(int) |
---|
[509] | 769 | |
---|
[369] | 770 | #undef macro |
---|
| 771 | |
---|
[1158] | 772 | #define macro(T)\ |
---|
| 773 | template <>\ |
---|
| 774 | void CInterface::AttributeFortran2003Interface<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 775 | {\ |
---|
| 776 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", str_len, str_size, extent) BIND(C)" << iendl; \ |
---|
| 777 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 778 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 779 | oss << " CHARACTER (KIND=C_CHAR), DIMENSION(*) :: " << name << iendl; \ |
---|
| 780 | oss << " INTEGER (kind = C_INT), VALUE :: str_len" << iendl; \ |
---|
| 781 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: str_size" << iendl; \ |
---|
| 782 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 783 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 784 | oss << iendl; \ |
---|
| 785 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", str_size, extent) BIND(C)" << iendl; \ |
---|
| 786 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 787 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 788 | oss << " CHARACTER (KIND=C_CHAR), DIMENSION(*) :: " << name << iendl; \ |
---|
| 789 | oss << " INTEGER (kind = C_INT), VALUE :: str_size" << iendl; \ |
---|
| 790 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 791 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 792 | } |
---|
| 793 | macro(1) |
---|
| 794 | macro(2) |
---|
| 795 | macro(3) |
---|
| 796 | macro(4) |
---|
| 797 | macro(5) |
---|
| 798 | macro(6) |
---|
| 799 | macro(7) |
---|
| 800 | |
---|
| 801 | #undef macro |
---|
| 802 | |
---|
[581] | 803 | #define macro(T) \ |
---|
[672] | 804 | template <> \ |
---|
| 805 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 806 | { \ |
---|
| 807 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:)"; \ |
---|
| 808 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:)"; \ |
---|
| 809 | } \ |
---|
| 810 | template <> \ |
---|
| 811 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 812 | { \ |
---|
| 813 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:)"; \ |
---|
| 814 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:)"; \ |
---|
| 815 | } \ |
---|
[369] | 816 | \ |
---|
[672] | 817 | template <> \ |
---|
| 818 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 819 | { \ |
---|
| 820 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:)"; \ |
---|
| 821 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:)"; \ |
---|
| 822 | } \ |
---|
[369] | 823 | \ |
---|
[672] | 824 | template <> \ |
---|
| 825 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 826 | { \ |
---|
| 827 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:)"; \ |
---|
| 828 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:)"; \ |
---|
| 829 | } \ |
---|
[369] | 830 | \ |
---|
[672] | 831 | template <> \ |
---|
| 832 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 833 | { \ |
---|
| 834 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:)"; \ |
---|
| 835 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:)"; \ |
---|
| 836 | } \ |
---|
[369] | 837 | \ |
---|
[672] | 838 | template <> \ |
---|
| 839 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 840 | { \ |
---|
| 841 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:)"; \ |
---|
| 842 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:)"; \ |
---|
[932] | 843 | }\ |
---|
| 844 | \ |
---|
| 845 | template <> \ |
---|
| 846 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 847 | { \ |
---|
| 848 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:)"; \ |
---|
| 849 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:)"; \ |
---|
| 850 | } \ |
---|
| 851 | \ |
---|
| 852 | template <> \ |
---|
| 853 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 854 | { \ |
---|
| 855 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:)"; \ |
---|
| 856 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:)"; \ |
---|
| 857 | }\ |
---|
| 858 | \ |
---|
| 859 | template <> \ |
---|
| 860 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 861 | { \ |
---|
| 862 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:)"; \ |
---|
| 863 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:)"; \ |
---|
| 864 | } \ |
---|
| 865 | \ |
---|
| 866 | template <> \ |
---|
| 867 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 868 | { \ |
---|
| 869 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:)"; \ |
---|
| 870 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:)"; \ |
---|
| 871 | }\ |
---|
| 872 | \ |
---|
| 873 | template <> \ |
---|
| 874 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 875 | { \ |
---|
| 876 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:,:)"; \ |
---|
| 877 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:)"; \ |
---|
| 878 | } \ |
---|
| 879 | \ |
---|
| 880 | template <> \ |
---|
| 881 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 882 | { \ |
---|
| 883 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:,:)"; \ |
---|
| 884 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:)"; \ |
---|
| 885 | }\ |
---|
| 886 | \ |
---|
| 887 | template <> \ |
---|
| 888 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 889 | { \ |
---|
| 890 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:,:,:)"; \ |
---|
| 891 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:,:)"; \ |
---|
| 892 | } \ |
---|
| 893 | \ |
---|
| 894 | template <> \ |
---|
| 895 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 896 | { \ |
---|
| 897 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:,:,:)"; \ |
---|
| 898 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:,:)"; \ |
---|
[672] | 899 | } |
---|
[509] | 900 | |
---|
[369] | 901 | macro(bool) |
---|
| 902 | macro(double) |
---|
| 903 | macro(int) |
---|
| 904 | |
---|
| 905 | #undef macro |
---|
| 906 | |
---|
[1158] | 907 | #define macro(T,EXTENT)\ |
---|
| 908 | template <> \ |
---|
| 909 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 910 | {\ |
---|
| 911 | oss << "CHARACTER(len=*) , OPTIONAL, INTENT(IN) :: " << name << "("<<EXTENT<<")"; \ |
---|
| 912 | }\ |
---|
| 913 | \ |
---|
| 914 | template <>\ |
---|
| 915 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 916 | {\ |
---|
| 917 | oss << "CHARACTER(len=*) , OPTIONAL, INTENT(OUT) :: " << name << "("<<EXTENT<<")"; \ |
---|
| 918 | } |
---|
| 919 | macro(1,":") |
---|
| 920 | macro(2,":,:") |
---|
| 921 | macro(3,":,:,:") |
---|
| 922 | macro(4,":,:,:,:") |
---|
| 923 | macro(5,":,:,:,:,:") |
---|
| 924 | macro(6,":,:,:,:,:,:") |
---|
| 925 | macro(7,":,:,:,:,:,:,:") |
---|
| 926 | |
---|
| 927 | #undef macro |
---|
| 928 | |
---|
| 929 | |
---|
| 930 | |
---|
| 931 | |
---|
| 932 | |
---|
| 933 | |
---|
[369] | 934 | #define macro(T) \ |
---|
[672] | 935 | template <> \ |
---|
| 936 | void CInterface::AttributeFortranInterfaceBody< CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 937 | { \ |
---|
| 938 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 939 | \ |
---|
[672] | 940 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 941 | if (!matchingTypeCFortran<T>()) \ |
---|
| 942 | { \ |
---|
[674] | 943 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1)))" << iendl; \ |
---|
[672] | 944 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 945 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 946 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 947 | } \ |
---|
[966] | 948 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 949 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 950 | oss << "ENDIF"; \ |
---|
| 951 | } \ |
---|
[369] | 952 | \ |
---|
[672] | 953 | template <> \ |
---|
| 954 | void CInterface::AttributeFortranInterfaceBody< CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 955 | { \ |
---|
| 956 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 957 | \ |
---|
[672] | 958 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 959 | if (!matchingTypeCFortran<T>()) \ |
---|
| 960 | { \ |
---|
[674] | 961 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2)))" << iendl; \ |
---|
[672] | 962 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 963 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 964 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 965 | } \ |
---|
[966] | 966 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 967 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 968 | oss << "ENDIF"; \ |
---|
| 969 | } \ |
---|
[932] | 970 | \ |
---|
[672] | 971 | template <> \ |
---|
| 972 | void CInterface::AttributeFortranInterfaceBody< CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 973 | { \ |
---|
| 974 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 975 | \ |
---|
[672] | 976 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 977 | if (!matchingTypeCFortran<T>()) \ |
---|
| 978 | { \ |
---|
[674] | 979 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3)))" << iendl; \ |
---|
[672] | 980 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 981 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 982 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 983 | } \ |
---|
[966] | 984 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 985 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 986 | oss << "ENDIF"; \ |
---|
[932] | 987 | }\ |
---|
| 988 | \ |
---|
| 989 | template <> \ |
---|
| 990 | void CInterface::AttributeFortranInterfaceBody< CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 991 | { \ |
---|
| 992 | string name_tmp=name+"__tmp"; \ |
---|
| 993 | \ |
---|
| 994 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 995 | if (!matchingTypeCFortran<T>()) \ |
---|
| 996 | { \ |
---|
[966] | 997 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 998 | oss << " SIZE(" << name << "_,4)))" << iendl; \ |
---|
[932] | 999 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1000 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1001 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1002 | } \ |
---|
[966] | 1003 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1004 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1005 | oss << "ENDIF"; \ |
---|
| 1006 | }\ |
---|
| 1007 | \ |
---|
| 1008 | template <> \ |
---|
| 1009 | void CInterface::AttributeFortranInterfaceBody< CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1010 | { \ |
---|
| 1011 | string name_tmp=name+"__tmp"; \ |
---|
| 1012 | \ |
---|
| 1013 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1014 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1015 | { \ |
---|
[966] | 1016 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1017 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5)))" << iendl; \ |
---|
[932] | 1018 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1019 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1020 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1021 | } \ |
---|
[966] | 1022 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1023 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1024 | oss << "ENDIF"; \ |
---|
| 1025 | }\ |
---|
| 1026 | \ |
---|
| 1027 | template <> \ |
---|
| 1028 | void CInterface::AttributeFortranInterfaceBody< CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1029 | { \ |
---|
| 1030 | string name_tmp=name+"__tmp"; \ |
---|
| 1031 | \ |
---|
| 1032 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1033 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1034 | { \ |
---|
[966] | 1035 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1036 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6)))" << iendl; \ |
---|
[932] | 1037 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1038 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1039 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1040 | } \ |
---|
[966] | 1041 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1042 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1043 | oss << "ENDIF"; \ |
---|
| 1044 | }\ |
---|
| 1045 | \ |
---|
| 1046 | template <> \ |
---|
| 1047 | void CInterface::AttributeFortranInterfaceBody< CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1048 | { \ |
---|
| 1049 | string name_tmp=name+"__tmp"; \ |
---|
| 1050 | \ |
---|
| 1051 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1052 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1053 | { \ |
---|
[966] | 1054 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1055 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6), &" << iendl; \ |
---|
| 1056 | oss << " SIZE(" << name << "_,7)))" << iendl; \ |
---|
[932] | 1057 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1058 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1059 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1060 | } \ |
---|
[966] | 1061 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1062 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1063 | oss << "ENDIF"; \ |
---|
[672] | 1064 | } |
---|
[509] | 1065 | |
---|
[369] | 1066 | macro(bool) |
---|
| 1067 | macro(double) |
---|
| 1068 | macro(int) |
---|
| 1069 | |
---|
| 1070 | #undef macro |
---|
| 1071 | |
---|
[1158] | 1072 | #define macro(T)\ |
---|
| 1073 | template <>\ |
---|
| 1074 | void CInterface::AttributeFortranInterfaceBody< CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 1075 | {\ |
---|
| 1076 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1077 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1078 | oss << "(" << className << "_hdl%daddr, " << name <<"_, LEN("<<name<<"_), LEN_TRIM("<<name<< "_), SHAPE(" << name << "_))" << iendl; \ |
---|
| 1079 | oss << "ENDIF"; \ |
---|
| 1080 | } |
---|
| 1081 | |
---|
| 1082 | macro(1) |
---|
| 1083 | macro(2) |
---|
| 1084 | #undef macro |
---|
| 1085 | |
---|
[369] | 1086 | #define macro(T) \ |
---|
[672] | 1087 | template <> \ |
---|
| 1088 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1089 | { \ |
---|
| 1090 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1091 | \ |
---|
[672] | 1092 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1093 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1094 | { \ |
---|
[674] | 1095 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1)))" << iendl; \ |
---|
[966] | 1096 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1097 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1098 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1099 | } \ |
---|
[966] | 1100 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1101 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1102 | oss << "ENDIF"; \ |
---|
| 1103 | } \ |
---|
[369] | 1104 | \ |
---|
[672] | 1105 | template <> \ |
---|
| 1106 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1107 | { \ |
---|
| 1108 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1109 | \ |
---|
[672] | 1110 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1111 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1112 | { \ |
---|
[674] | 1113 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2)))" << iendl; \ |
---|
[966] | 1114 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1115 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1116 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1117 | } \ |
---|
[966] | 1118 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1119 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1120 | oss << "ENDIF"; \ |
---|
| 1121 | } \ |
---|
[932] | 1122 | \ |
---|
[672] | 1123 | template <> \ |
---|
| 1124 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1125 | { \ |
---|
| 1126 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1127 | \ |
---|
[672] | 1128 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1129 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1130 | { \ |
---|
[674] | 1131 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3)))" << iendl; \ |
---|
[966] | 1132 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1133 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1134 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
[369] | 1135 | } \ |
---|
[966] | 1136 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1137 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1138 | oss << "ENDIF"; \ |
---|
[932] | 1139 | } \ |
---|
| 1140 | \ |
---|
| 1141 | template <> \ |
---|
| 1142 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1143 | { \ |
---|
| 1144 | string name_tmp=name+"__tmp"; \ |
---|
| 1145 | \ |
---|
| 1146 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1147 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1148 | { \ |
---|
[966] | 1149 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1150 | oss << " SIZE(" << name << "_,4)))" << iendl; \ |
---|
| 1151 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1152 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1153 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1154 | } \ |
---|
[966] | 1155 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1156 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; }\ |
---|
[932] | 1157 | oss << "ENDIF"; \ |
---|
| 1158 | } \ |
---|
| 1159 | \ |
---|
| 1160 | template <> \ |
---|
| 1161 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1162 | { \ |
---|
| 1163 | string name_tmp=name+"__tmp"; \ |
---|
| 1164 | \ |
---|
| 1165 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1166 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1167 | { \ |
---|
[966] | 1168 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1169 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5)))" << iendl; \ |
---|
| 1170 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1171 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1172 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1173 | } \ |
---|
[966] | 1174 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1175 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1176 | oss << "ENDIF"; \ |
---|
| 1177 | }\ |
---|
| 1178 | \ |
---|
| 1179 | template <> \ |
---|
| 1180 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1181 | { \ |
---|
| 1182 | string name_tmp=name+"__tmp"; \ |
---|
| 1183 | \ |
---|
| 1184 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1185 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1186 | { \ |
---|
[966] | 1187 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1188 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6)))" << iendl; \ |
---|
| 1189 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1190 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1191 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1192 | } \ |
---|
[966] | 1193 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1194 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1195 | oss << "ENDIF"; \ |
---|
| 1196 | } \ |
---|
| 1197 | \ |
---|
| 1198 | template <> \ |
---|
| 1199 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1200 | { \ |
---|
| 1201 | string name_tmp=name+"__tmp"; \ |
---|
| 1202 | \ |
---|
| 1203 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1204 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1205 | { \ |
---|
[966] | 1206 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1207 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6), &" << iendl; \ |
---|
| 1208 | oss << " SIZE(" << name << "_,7)))" << iendl; \ |
---|
| 1209 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1210 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1211 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1212 | } \ |
---|
[966] | 1213 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1214 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1215 | oss << "ENDIF"; \ |
---|
[672] | 1216 | } |
---|
[509] | 1217 | |
---|
[369] | 1218 | macro(bool) |
---|
| 1219 | macro(double) |
---|
| 1220 | macro(int) |
---|
| 1221 | |
---|
| 1222 | #undef macro |
---|
[1158] | 1223 | |
---|
| 1224 | #define macro(T)\ |
---|
| 1225 | template <> \ |
---|
| 1226 | void CInterface::AttributeFortranInterfaceGetBody< CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 1227 | {\ |
---|
| 1228 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1229 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1230 | oss << "(" << className << "_hdl%daddr, " << name << "_, LEN("<<name<<"_), SHAPE(" << name << "_))" << iendl; \ |
---|
| 1231 | oss << "ENDIF"; \ |
---|
| 1232 | } |
---|
| 1233 | macro(1) |
---|
| 1234 | macro(2) |
---|
| 1235 | macro(3) |
---|
| 1236 | macro(4) |
---|
| 1237 | macro(5) |
---|
| 1238 | macro(6) |
---|
| 1239 | macro(7) |
---|
| 1240 | |
---|
| 1241 | #undef macro |
---|
| 1242 | |
---|
[313] | 1243 | } |
---|
| 1244 | #endif |
---|