[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 | |
---|
[672] | 217 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 218 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 219 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 220 | oss << " " << fortranType << " " << fortranKindC << " , VALUE :: " << name << iendl; |
---|
| 221 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
| 222 | oss << iendl; |
---|
| 223 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 224 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 225 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 226 | oss << " " << fortranType << " " << fortranKindC << " :: " << name << iendl; |
---|
| 227 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
| 228 | } |
---|
[369] | 229 | |
---|
[532] | 230 | template <> |
---|
[672] | 231 | void CInterface::AttributeFortran2003Interface<string>(ostream& oss, const string& className, const string& name) |
---|
| 232 | { |
---|
| 233 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", " << name << "_size) BIND(C)" << iendl; |
---|
| 234 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 235 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 236 | oss << " CHARACTER(kind = C_CHAR) , DIMENSION(*) :: " << name << iendl; |
---|
| 237 | oss << " INTEGER (kind = C_INT) , VALUE :: " << name << "_size" << iendl; |
---|
| 238 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
| 239 | oss << iendl; |
---|
| 240 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", " << name << "_size) BIND(C)" << iendl; |
---|
| 241 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 242 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 243 | oss << " CHARACTER(kind = C_CHAR) , DIMENSION(*) :: " << name << iendl; |
---|
| 244 | oss << " INTEGER (kind = C_INT) , VALUE :: " << name << "_size" << iendl; |
---|
| 245 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | template <> |
---|
[532] | 249 | void CInterface::AttributeFortran2003Interface<CDate>(ostream& oss, const string& className, const string& name) |
---|
| 250 | { |
---|
| 251 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 252 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 253 | oss << " USE IDATE" << iendl; |
---|
| 254 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
[537] | 255 | oss << " TYPE(txios(date)), VALUE :: " << name << iendl; |
---|
[581] | 256 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
[532] | 257 | oss << iendl; |
---|
| 258 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 259 | oss << " USE ISO_C_BINDING" << iendl; |
---|
| 260 | oss << " USE IDATE" << iendl; |
---|
| 261 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 262 | oss << " TYPE(txios(date)) :: " << name << iendl; |
---|
[581] | 263 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
[532] | 264 | } |
---|
| 265 | |
---|
[537] | 266 | template <> |
---|
| 267 | void CInterface::AttributeFortran2003Interface<CDuration>(ostream& oss, const string& className, const string& name) |
---|
| 268 | { |
---|
| 269 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 270 | oss << " USE ISO_C_BINDING" << iendl; |
---|
[545] | 271 | oss << " USE IDURATION" << iendl; |
---|
[537] | 272 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 273 | oss << " TYPE(txios(duration)), VALUE :: " << name << iendl; |
---|
[581] | 274 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; |
---|
[537] | 275 | oss << iendl; |
---|
| 276 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; |
---|
| 277 | oss << " USE ISO_C_BINDING" << iendl; |
---|
[545] | 278 | oss << " USE IDURATION" << iendl; |
---|
[537] | 279 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; |
---|
| 280 | oss << " TYPE(txios(duration)) :: " << name << iendl; |
---|
[581] | 281 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; |
---|
[537] | 282 | } |
---|
| 283 | |
---|
[672] | 284 | template <class T> |
---|
| 285 | void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 286 | { |
---|
| 287 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name; |
---|
| 288 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " :: " << name << "_tmp"; |
---|
| 289 | } |
---|
[509] | 290 | |
---|
[672] | 291 | template <class T> |
---|
| 292 | void CInterface::AttributeFortranInterfaceGetDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 293 | { |
---|
| 294 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name; |
---|
| 295 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " :: " << name << "_tmp"; |
---|
| 296 | } |
---|
[369] | 297 | |
---|
[672] | 298 | void CInterface::AttributeFortranInterfaceIsDefinedDeclaration(ostream& oss, const string& className, const string& name) |
---|
| 299 | { |
---|
| 300 | oss << "LOGICAL, OPTIONAL, INTENT(OUT) :: " << name << iendl; |
---|
| 301 | oss << "LOGICAL(KIND=C_BOOL) :: " << name << "_tmp"; |
---|
| 302 | } |
---|
[313] | 303 | |
---|
[672] | 304 | template <> |
---|
| 305 | void CInterface::AttributeFortranInterfaceDeclaration<string>(ostream& oss, const string& className, const string& name) |
---|
| 306 | { |
---|
| 307 | oss << "CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: " << name; |
---|
| 308 | } |
---|
[509] | 309 | |
---|
[672] | 310 | template <> |
---|
| 311 | void CInterface::AttributeFortranInterfaceGetDeclaration<string>(ostream& oss, const string& className, const string& name) |
---|
| 312 | { |
---|
| 313 | oss << "CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: " << name; |
---|
| 314 | } |
---|
[509] | 315 | |
---|
[672] | 316 | template <class T> |
---|
| 317 | void CInterface::AttributeFortranInterfaceBody(ostream& oss, const string& className, const string& name) |
---|
| 318 | { |
---|
| 319 | string name_tmp=name+"__tmp"; |
---|
[509] | 320 | |
---|
[672] | 321 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
| 322 | if (!matchingTypeCFortran<T>()) |
---|
| 323 | { |
---|
| 324 | oss << " " << name_tmp << " = " << name << "_" << iendl; |
---|
[966] | 325 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 326 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ")" << iendl; |
---|
[672] | 327 | } |
---|
[966] | 328 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 329 | oss << "(" << className << "_hdl%daddr, " << name << "_)" << iendl; } |
---|
[672] | 330 | oss << "ENDIF"; |
---|
| 331 | } |
---|
[313] | 332 | |
---|
[672] | 333 | template <class T> |
---|
| 334 | void CInterface::AttributeFortranInterfaceGetBody(ostream& oss, const string& className, const string& name) |
---|
| 335 | { |
---|
| 336 | string name_tmp=name+"__tmp"; |
---|
[509] | 337 | |
---|
[672] | 338 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
| 339 | if (!matchingTypeCFortran<T>()) |
---|
| 340 | { |
---|
[966] | 341 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 342 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ")" << iendl; |
---|
[672] | 343 | oss << " " << name << "_ = " << name_tmp << iendl; |
---|
| 344 | } |
---|
[966] | 345 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 346 | oss << "(" << className << "_hdl%daddr, " << name << "_)" << iendl; } |
---|
[672] | 347 | oss << "ENDIF"; |
---|
| 348 | } |
---|
[313] | 349 | |
---|
[672] | 350 | void CInterface::AttributeFortranInterfaceIsDefinedBody(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; |
---|
[966] | 355 | oss << " " << name << "__tmp = cxios_is_defined_" << className << "_" << name << " &" << iendl; |
---|
| 356 | oss << "(" << className << "_hdl%daddr)" << iendl; |
---|
[672] | 357 | oss << " " << name << "_ = " << name_tmp << iendl; |
---|
| 358 | oss << "ENDIF"; |
---|
| 359 | } |
---|
[509] | 360 | |
---|
[672] | 361 | template <> |
---|
| 362 | void CInterface::AttributeFortranInterfaceBody<string>(ostream& oss, const string& className, const string& name) |
---|
| 363 | { |
---|
| 364 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
[966] | 365 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; |
---|
| 366 | oss << "(" << className << "_hdl%daddr, " << name << "_, len(" << name << "_))" << iendl; |
---|
[672] | 367 | oss << "ENDIF"; |
---|
| 368 | } |
---|
[509] | 369 | |
---|
[672] | 370 | template <> |
---|
| 371 | void CInterface::AttributeFortranInterfaceGetBody<string>(ostream& oss, const string& className, const string& name) |
---|
| 372 | { |
---|
| 373 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; |
---|
[966] | 374 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; |
---|
| 375 | oss << "(" << className << "_hdl%daddr, " << name << "_, len(" << name << "_))" << iendl; |
---|
[672] | 376 | oss << "ENDIF"; |
---|
| 377 | } |
---|
[509] | 378 | |
---|
[369] | 379 | // declaration for CArray |
---|
| 380 | |
---|
| 381 | #define macro(T) \ |
---|
[581] | 382 | template <> \ |
---|
| 383 | void CInterface::AttributeCInterface<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 384 | { \ |
---|
| 385 | string typeName=getStrType<T>(); \ |
---|
[369] | 386 | \ |
---|
[674] | 387 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 388 | oss << "{" << iendl; \ |
---|
| 389 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 390 | oss << " CArray<" << typeName << ",1> tmp(" << name << ", shape(extent[0]), neverDeleteData);" << iendl; \ |
---|
[581] | 391 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 392 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 393 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 394 | oss << "}" << std::endl; \ |
---|
| 395 | oss << iendl; \ |
---|
[674] | 396 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 397 | oss << "{" << iendl; \ |
---|
| 398 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 399 | oss << " CArray<" << typeName << ",1> tmp(" << name << ", shape(extent[0]), neverDeleteData);" << iendl; \ |
---|
[581] | 400 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 401 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 402 | oss << "}" << std::endl; \ |
---|
| 403 | } \ |
---|
[369] | 404 | \ |
---|
| 405 | template <> \ |
---|
[581] | 406 | void CInterface::AttributeCInterface<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 407 | { \ |
---|
| 408 | string typeName=getStrType<T>(); \ |
---|
[369] | 409 | \ |
---|
[674] | 410 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 411 | oss << "{" << iendl; \ |
---|
| 412 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 413 | oss << " CArray<" << typeName << ",2> tmp(" << name << ", shape(extent[0], extent[1]), neverDeleteData);" << iendl; \ |
---|
[581] | 414 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 415 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 416 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 417 | oss << "}" << std::endl; \ |
---|
| 418 | oss << iendl; \ |
---|
[674] | 419 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 420 | oss << "{" << iendl; \ |
---|
| 421 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 422 | oss << " CArray<" << typeName << ",2> tmp(" << name << ", shape(extent[0], extent[1]), neverDeleteData);" << iendl; \ |
---|
[581] | 423 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 424 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 425 | oss << "}" << std::endl; \ |
---|
| 426 | } \ |
---|
[369] | 427 | \ |
---|
[581] | 428 | template <> \ |
---|
| 429 | void CInterface::AttributeCInterface<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 430 | { \ |
---|
| 431 | string typeName=getStrType<T>(); \ |
---|
[369] | 432 | \ |
---|
[674] | 433 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 434 | oss << "{" << iendl; \ |
---|
| 435 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 436 | oss << " CArray<" << typeName << ",3> tmp(" << name << ", shape(extent[0], extent[1], extent[2]), neverDeleteData);" << iendl; \ |
---|
[581] | 437 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 438 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 439 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 440 | oss << "}" << std::endl; \ |
---|
| 441 | oss << iendl; \ |
---|
[674] | 442 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
[581] | 443 | oss << "{" << iendl; \ |
---|
| 444 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
[674] | 445 | oss << " CArray<" << typeName << ",3> tmp(" << name << ", shape(extent[0], extent[1], extent[2]), neverDeleteData);" << iendl; \ |
---|
[581] | 446 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 447 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 448 | oss << "}" << std::endl; \ |
---|
[932] | 449 | } \ |
---|
| 450 | \ |
---|
| 451 | template <> \ |
---|
| 452 | void CInterface::AttributeCInterface<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 453 | { \ |
---|
| 454 | string typeName=getStrType<T>(); \ |
---|
| 455 | \ |
---|
| 456 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 457 | oss << "{" << iendl; \ |
---|
| 458 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 459 | oss << " CArray<" << typeName << ",4> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3]), neverDeleteData);" << iendl; \ |
---|
| 460 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 461 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 462 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 463 | oss << "}" << std::endl; \ |
---|
| 464 | oss << iendl; \ |
---|
| 465 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 466 | oss << "{" << iendl; \ |
---|
| 467 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 468 | oss << " CArray<" << typeName << ",4> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3]), neverDeleteData);" << iendl; \ |
---|
| 469 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 470 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 471 | oss << "}" << std::endl; \ |
---|
| 472 | } \ |
---|
| 473 | \ |
---|
| 474 | template <> \ |
---|
| 475 | void CInterface::AttributeCInterface<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 476 | { \ |
---|
| 477 | string typeName=getStrType<T>(); \ |
---|
| 478 | \ |
---|
| 479 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 480 | oss << "{" << iendl; \ |
---|
| 481 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 482 | oss << " CArray<" << typeName << ",5> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4]), neverDeleteData);" << iendl; \ |
---|
| 483 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 484 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 485 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 486 | oss << "}" << std::endl; \ |
---|
| 487 | oss << iendl; \ |
---|
| 488 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 489 | oss << "{" << iendl; \ |
---|
| 490 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 491 | oss << " CArray<" << typeName << ",5> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4]), neverDeleteData);" << iendl; \ |
---|
| 492 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 493 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 494 | oss << "}" << std::endl; \ |
---|
| 495 | } \ |
---|
| 496 | \ |
---|
| 497 | template <> \ |
---|
| 498 | void CInterface::AttributeCInterface<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 499 | { \ |
---|
| 500 | string typeName=getStrType<T>(); \ |
---|
| 501 | \ |
---|
| 502 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 503 | oss << "{" << iendl; \ |
---|
| 504 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 505 | oss << " CArray<" << typeName << ",6> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]), neverDeleteData);" << iendl; \ |
---|
| 506 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 507 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 508 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 509 | oss << "}" << std::endl; \ |
---|
| 510 | oss << iendl; \ |
---|
| 511 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 512 | oss << "{" << iendl; \ |
---|
| 513 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 514 | oss << " CArray<" << typeName << ",6> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]), neverDeleteData);" << iendl; \ |
---|
| 515 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 516 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 517 | oss << "}" << std::endl; \ |
---|
| 518 | } \ |
---|
| 519 | \ |
---|
| 520 | template <> \ |
---|
| 521 | void CInterface::AttributeCInterface<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 522 | { \ |
---|
| 523 | string typeName=getStrType<T>(); \ |
---|
| 524 | \ |
---|
| 525 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 526 | oss << "{" << iendl; \ |
---|
| 527 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 528 | oss << " CArray<" << typeName << ",7> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5], extent[6]), neverDeleteData);" << iendl; \ |
---|
| 529 | oss << " " << className << "_hdl->" << name << ".reference(tmp.copy());" << iendl; \ |
---|
| 530 | /*oss << " " << className << "_hdl->sendAttributToServer(" << className << "_hdl->" << name << ");" << iendl;*/ \ |
---|
| 531 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 532 | oss << "}" << std::endl; \ |
---|
| 533 | oss << iendl; \ |
---|
| 534 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << typeName << "* " << name << ", int* extent)" << iendl; \ |
---|
| 535 | oss << "{" << iendl; \ |
---|
| 536 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 537 | oss << " CArray<" << typeName << ",7> tmp(" << name << ", shape(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5], extent[6]), neverDeleteData);" << iendl; \ |
---|
| 538 | oss << " tmp=" << className << "_hdl->" << name << ".getInheritedValue();" << iendl; \ |
---|
| 539 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 540 | oss << "}" << std::endl; \ |
---|
[369] | 541 | } |
---|
| 542 | |
---|
| 543 | macro(bool) |
---|
| 544 | macro(double) |
---|
| 545 | macro(int) |
---|
| 546 | |
---|
[509] | 547 | #undef macro |
---|
[369] | 548 | |
---|
[1050] | 549 | #define macro(N,EXTENT)\ |
---|
| 550 | template <>\ |
---|
| 551 | void CInterface::AttributeCInterface<CArray<StdString,N> >(ostream& oss, const string& className, const string& name)\ |
---|
| 552 | { \ |
---|
| 553 | oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << "char* " << name <<", int str_len, int* str_size, int* extent)" << iendl; \ |
---|
| 554 | oss << "{" << iendl; \ |
---|
| 555 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 556 | oss << " "<<className<<"_hdl->"<<name<<".resize(shape("<<EXTENT<<"));"<<iendl;\ |
---|
| 557 | oss << " Array<StdString,"<<#N<<">::iterator it, itb="<<className<<"_hdl->"<<name<<".begin(), ite="<<className<<"_hdl->"<<name<<".end() ;"<<iendl ;\ |
---|
| 558 | oss << " int i, n ;"<< iendl; \ |
---|
| 559 | oss << " for(it=itb, i=0, n=0 ; it!=ite ; ++it,n+=str_len,++i) *it=StdString(&"<<name<<"[n],str_size[i]) ;"<<iendl ;\ |
---|
| 560 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 561 | oss << "}" << std::endl; \ |
---|
| 562 | oss << iendl; \ |
---|
| 563 | oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, " << "char* " << name << ", int str_size, int* extent)" << iendl; \ |
---|
| 564 | oss << "{" << iendl; \ |
---|
| 565 | oss << " CTimer::get(\"XIOS\").resume();" << iendl; \ |
---|
| 566 | oss << " Array<StdString,"<<#N<<">::const_iterator it, itb="<<className<<"_hdl->"<<name<<".getInheritedValue().begin(), ite="<<className<<"_hdl->"<<name<<".getInheritedValue().end() ;" << iendl; \ |
---|
| 567 | oss << " int n ;"<< iendl; \ |
---|
| 568 | oss << " for(it=itb, n=0 ; it!=ite ; ++it, n+=str_size) it->copy(&"<<name<<"[n],it->size()) ; "<< iendl; \ |
---|
| 569 | oss << " CTimer::get(\"XIOS\").suspend();" << iendl; \ |
---|
| 570 | oss << "}" << std::endl; \ |
---|
| 571 | } |
---|
| 572 | |
---|
| 573 | macro(1,"extent[0]") |
---|
| 574 | macro(2,"extent[0],extent[1]") |
---|
| 575 | macro(3,"extent[0],extent[1],extent[2]") |
---|
| 576 | macro(4,"extent[0],extent[1],extent[2],extent[3]") |
---|
| 577 | macro(5,"extent[0],extent[1],extent[2],extent[3],extent[4]") |
---|
| 578 | macro(6,"extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]") |
---|
| 579 | macro(7,"extent[0],extent[1],extent[2],extent[3],extent[4],extent[5],extent[6]") |
---|
| 580 | #undef macro |
---|
[369] | 581 | // ///////////////////////////////////////////////// |
---|
| 582 | // // Fortran 2003 Interface // |
---|
| 583 | // ///////////////////////////////////////////////// |
---|
| 584 | |
---|
[581] | 585 | #define macro(T) \ |
---|
[672] | 586 | template <> \ |
---|
| 587 | void CInterface::AttributeFortran2003Interface<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 588 | { \ |
---|
| 589 | string fortranType=getStrFortranType<T>(); \ |
---|
| 590 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 591 | \ |
---|
[674] | 592 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 593 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 594 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 595 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 596 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 597 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 598 | oss << iendl; \ |
---|
[674] | 599 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 600 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 601 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 602 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 603 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 604 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 605 | } \ |
---|
[369] | 606 | \ |
---|
[672] | 607 | template <> \ |
---|
| 608 | void CInterface::AttributeFortran2003Interface<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 609 | { \ |
---|
| 610 | string fortranType=getStrFortranType<T>(); \ |
---|
| 611 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 612 | \ |
---|
[674] | 613 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 614 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 615 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 616 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 617 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 618 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 619 | oss << iendl; \ |
---|
[674] | 620 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 621 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 622 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 623 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 624 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 625 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 626 | } \ |
---|
[932] | 627 | \ |
---|
[672] | 628 | template <> \ |
---|
| 629 | void CInterface::AttributeFortran2003Interface<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 630 | { \ |
---|
| 631 | string fortranType=getStrFortranType<T>(); \ |
---|
| 632 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
[369] | 633 | \ |
---|
[674] | 634 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 635 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 636 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 637 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 638 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 639 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 640 | oss << iendl; \ |
---|
[674] | 641 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
[672] | 642 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 643 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 644 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
[674] | 645 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
[672] | 646 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
[932] | 647 | } \ |
---|
| 648 | \ |
---|
| 649 | template <> \ |
---|
| 650 | void CInterface::AttributeFortran2003Interface<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 651 | { \ |
---|
| 652 | string fortranType=getStrFortranType<T>(); \ |
---|
| 653 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 654 | \ |
---|
| 655 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 656 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 657 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 658 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 659 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 660 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 661 | oss << iendl; \ |
---|
| 662 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 663 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 664 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 665 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 666 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 667 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 668 | }\ |
---|
| 669 | \ |
---|
| 670 | template <> \ |
---|
| 671 | void CInterface::AttributeFortran2003Interface<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 672 | { \ |
---|
| 673 | string fortranType=getStrFortranType<T>(); \ |
---|
| 674 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 675 | \ |
---|
| 676 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 677 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 678 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 679 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 680 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 681 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 682 | oss << iendl; \ |
---|
| 683 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 684 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 685 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 686 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 687 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 688 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 689 | }\ |
---|
| 690 | \ |
---|
| 691 | template <> \ |
---|
| 692 | void CInterface::AttributeFortran2003Interface<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 693 | { \ |
---|
| 694 | string fortranType=getStrFortranType<T>(); \ |
---|
| 695 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 696 | \ |
---|
| 697 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 698 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 699 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 700 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 701 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 702 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 703 | oss << iendl; \ |
---|
| 704 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 705 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 706 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 707 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 708 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 709 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 710 | }\ |
---|
| 711 | \ |
---|
| 712 | template <> \ |
---|
| 713 | void CInterface::AttributeFortran2003Interface<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 714 | { \ |
---|
| 715 | string fortranType=getStrFortranType<T>(); \ |
---|
| 716 | string fortranKindC=getStrFortranKindC<T>(); \ |
---|
| 717 | \ |
---|
| 718 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 719 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 720 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 721 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 722 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 723 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 724 | oss << iendl; \ |
---|
| 725 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", extent) BIND(C)" << iendl; \ |
---|
| 726 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 727 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 728 | oss << " " << fortranType << " " << fortranKindC << " , DIMENSION(*) :: " << name << iendl; \ |
---|
| 729 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 730 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
[672] | 731 | } |
---|
[509] | 732 | |
---|
[369] | 733 | macro(bool) |
---|
| 734 | macro(double) |
---|
| 735 | macro(int) |
---|
[509] | 736 | |
---|
[369] | 737 | #undef macro |
---|
| 738 | |
---|
[1050] | 739 | #define macro(T)\ |
---|
| 740 | template <>\ |
---|
| 741 | void CInterface::AttributeFortran2003Interface<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 742 | {\ |
---|
| 743 | oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ", str_len, str_size, extent) BIND(C)" << iendl; \ |
---|
| 744 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 745 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 746 | oss << " CHARACTER (KIND=C_CHAR), DIMENSION(*) :: " << name << iendl; \ |
---|
| 747 | oss << " INTEGER (kind = C_INT), VALUE :: str_len" << iendl; \ |
---|
| 748 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: str_size" << iendl; \ |
---|
| 749 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 750 | oss << "END SUBROUTINE cxios_set_" << className << "_" << name << std::endl; \ |
---|
| 751 | oss << iendl; \ |
---|
| 752 | oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ", str_size, extent) BIND(C)" << iendl; \ |
---|
| 753 | oss << " USE ISO_C_BINDING" << iendl; \ |
---|
| 754 | oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; \ |
---|
| 755 | oss << " CHARACTER (KIND=C_CHAR), DIMENSION(*) :: " << name << iendl; \ |
---|
| 756 | oss << " INTEGER (kind = C_INT), VALUE :: str_size" << iendl; \ |
---|
| 757 | oss << " INTEGER (kind = C_INT), DIMENSION(*) :: extent" << iendl; \ |
---|
| 758 | oss << "END SUBROUTINE cxios_get_" << className << "_" << name << std::endl; \ |
---|
| 759 | } |
---|
| 760 | macro(1) |
---|
| 761 | macro(2) |
---|
| 762 | macro(3) |
---|
| 763 | macro(4) |
---|
| 764 | macro(5) |
---|
| 765 | macro(6) |
---|
| 766 | macro(7) |
---|
| 767 | |
---|
| 768 | #undef macro |
---|
| 769 | |
---|
[581] | 770 | #define macro(T) \ |
---|
[672] | 771 | template <> \ |
---|
| 772 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 773 | { \ |
---|
| 774 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:)"; \ |
---|
| 775 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:)"; \ |
---|
| 776 | } \ |
---|
| 777 | template <> \ |
---|
| 778 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 779 | { \ |
---|
| 780 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:)"; \ |
---|
| 781 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:)"; \ |
---|
| 782 | } \ |
---|
[369] | 783 | \ |
---|
[672] | 784 | template <> \ |
---|
| 785 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 786 | { \ |
---|
| 787 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:)"; \ |
---|
| 788 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:)"; \ |
---|
| 789 | } \ |
---|
[369] | 790 | \ |
---|
[672] | 791 | template <> \ |
---|
| 792 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 793 | { \ |
---|
| 794 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:)"; \ |
---|
| 795 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:)"; \ |
---|
| 796 | } \ |
---|
[369] | 797 | \ |
---|
[672] | 798 | template <> \ |
---|
| 799 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 800 | { \ |
---|
| 801 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:)"; \ |
---|
| 802 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:)"; \ |
---|
| 803 | } \ |
---|
[369] | 804 | \ |
---|
[672] | 805 | template <> \ |
---|
| 806 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 807 | { \ |
---|
| 808 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:)"; \ |
---|
| 809 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:)"; \ |
---|
[932] | 810 | }\ |
---|
| 811 | \ |
---|
| 812 | template <> \ |
---|
| 813 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 814 | { \ |
---|
| 815 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:)"; \ |
---|
| 816 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:)"; \ |
---|
| 817 | } \ |
---|
| 818 | \ |
---|
| 819 | template <> \ |
---|
| 820 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 821 | { \ |
---|
| 822 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:)"; \ |
---|
| 823 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:)"; \ |
---|
| 824 | }\ |
---|
| 825 | \ |
---|
| 826 | template <> \ |
---|
| 827 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 828 | { \ |
---|
| 829 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:)"; \ |
---|
| 830 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:)"; \ |
---|
| 831 | } \ |
---|
| 832 | \ |
---|
| 833 | template <> \ |
---|
| 834 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 835 | { \ |
---|
| 836 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:)"; \ |
---|
| 837 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:)"; \ |
---|
| 838 | }\ |
---|
| 839 | \ |
---|
| 840 | template <> \ |
---|
| 841 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 842 | { \ |
---|
| 843 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:,:)"; \ |
---|
| 844 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:)"; \ |
---|
| 845 | } \ |
---|
| 846 | \ |
---|
| 847 | template <> \ |
---|
| 848 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 849 | { \ |
---|
| 850 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:,:)"; \ |
---|
| 851 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:)"; \ |
---|
| 852 | }\ |
---|
| 853 | \ |
---|
| 854 | template <> \ |
---|
| 855 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 856 | { \ |
---|
| 857 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(IN) :: " << name << "(:,:,:,:,:,:,:)"; \ |
---|
| 858 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:,:)"; \ |
---|
| 859 | } \ |
---|
| 860 | \ |
---|
| 861 | template <> \ |
---|
| 862 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 863 | { \ |
---|
| 864 | oss << getStrFortranType<T>() << " " << getStrFortranKind<T>() << " , OPTIONAL, INTENT(OUT) :: " << name << "(:,:,:,:,:,:,:)"; \ |
---|
| 865 | if (!matchingTypeCFortran<T>()) oss << iendl << getStrFortranType<T>() << " " << getStrFortranKindC<T>() << " , ALLOCATABLE :: " << name << "_tmp(:,:,:,:,:,:,:)"; \ |
---|
[672] | 866 | } |
---|
[509] | 867 | |
---|
[369] | 868 | macro(bool) |
---|
| 869 | macro(double) |
---|
| 870 | macro(int) |
---|
| 871 | |
---|
| 872 | #undef macro |
---|
| 873 | |
---|
[1050] | 874 | #define macro(T,EXTENT)\ |
---|
| 875 | template <> \ |
---|
| 876 | void CInterface::AttributeFortranInterfaceDeclaration<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 877 | {\ |
---|
| 878 | oss << "CHARACTER(len=*) , OPTIONAL, INTENT(IN) :: " << name << "("<<EXTENT<<")"; \ |
---|
| 879 | }\ |
---|
| 880 | \ |
---|
| 881 | template <>\ |
---|
| 882 | void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 883 | {\ |
---|
| 884 | oss << "CHARACTER(len=*) , OPTIONAL, INTENT(OUT) :: " << name << "("<<EXTENT<<")"; \ |
---|
| 885 | } |
---|
| 886 | macro(1,":") |
---|
| 887 | macro(2,":,:") |
---|
| 888 | macro(3,":,:,:") |
---|
| 889 | macro(4,":,:,:,:") |
---|
| 890 | macro(5,":,:,:,:,:") |
---|
| 891 | macro(6,":,:,:,:,:,:") |
---|
| 892 | macro(7,":,:,:,:,:,:,:") |
---|
| 893 | |
---|
| 894 | #undef macro |
---|
| 895 | |
---|
| 896 | |
---|
| 897 | |
---|
| 898 | |
---|
| 899 | |
---|
| 900 | |
---|
[369] | 901 | #define macro(T) \ |
---|
[672] | 902 | template <> \ |
---|
| 903 | void CInterface::AttributeFortranInterfaceBody< CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 904 | { \ |
---|
| 905 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 906 | \ |
---|
[672] | 907 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 908 | if (!matchingTypeCFortran<T>()) \ |
---|
| 909 | { \ |
---|
[674] | 910 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1)))" << iendl; \ |
---|
[672] | 911 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 912 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 913 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 914 | } \ |
---|
[966] | 915 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 916 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 917 | oss << "ENDIF"; \ |
---|
| 918 | } \ |
---|
[369] | 919 | \ |
---|
[672] | 920 | template <> \ |
---|
| 921 | void CInterface::AttributeFortranInterfaceBody< CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 922 | { \ |
---|
| 923 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 924 | \ |
---|
[672] | 925 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 926 | if (!matchingTypeCFortran<T>()) \ |
---|
| 927 | { \ |
---|
[674] | 928 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2)))" << iendl; \ |
---|
[672] | 929 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 930 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 931 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 932 | } \ |
---|
[966] | 933 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 934 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 935 | oss << "ENDIF"; \ |
---|
| 936 | } \ |
---|
[932] | 937 | \ |
---|
[672] | 938 | template <> \ |
---|
| 939 | void CInterface::AttributeFortranInterfaceBody< CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 940 | { \ |
---|
| 941 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 942 | \ |
---|
[672] | 943 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 944 | if (!matchingTypeCFortran<T>()) \ |
---|
| 945 | { \ |
---|
[674] | 946 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3)))" << iendl; \ |
---|
[672] | 947 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 948 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 949 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 950 | } \ |
---|
[966] | 951 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 952 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 953 | oss << "ENDIF"; \ |
---|
[932] | 954 | }\ |
---|
| 955 | \ |
---|
| 956 | template <> \ |
---|
| 957 | void CInterface::AttributeFortranInterfaceBody< CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 958 | { \ |
---|
| 959 | string name_tmp=name+"__tmp"; \ |
---|
| 960 | \ |
---|
| 961 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 962 | if (!matchingTypeCFortran<T>()) \ |
---|
| 963 | { \ |
---|
[966] | 964 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 965 | oss << " SIZE(" << name << "_,4)))" << iendl; \ |
---|
[932] | 966 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 967 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 968 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 969 | } \ |
---|
[966] | 970 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 971 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 972 | oss << "ENDIF"; \ |
---|
| 973 | }\ |
---|
| 974 | \ |
---|
| 975 | template <> \ |
---|
| 976 | void CInterface::AttributeFortranInterfaceBody< CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 977 | { \ |
---|
| 978 | string name_tmp=name+"__tmp"; \ |
---|
| 979 | \ |
---|
| 980 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 981 | if (!matchingTypeCFortran<T>()) \ |
---|
| 982 | { \ |
---|
[966] | 983 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 984 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5)))" << iendl; \ |
---|
[932] | 985 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 986 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 987 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 988 | } \ |
---|
[966] | 989 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 990 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 991 | oss << "ENDIF"; \ |
---|
| 992 | }\ |
---|
| 993 | \ |
---|
| 994 | template <> \ |
---|
| 995 | void CInterface::AttributeFortranInterfaceBody< CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 996 | { \ |
---|
| 997 | string name_tmp=name+"__tmp"; \ |
---|
| 998 | \ |
---|
| 999 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1000 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1001 | { \ |
---|
[966] | 1002 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1003 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6)))" << iendl; \ |
---|
[932] | 1004 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1005 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1006 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1007 | } \ |
---|
[966] | 1008 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1009 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1010 | oss << "ENDIF"; \ |
---|
| 1011 | }\ |
---|
| 1012 | \ |
---|
| 1013 | template <> \ |
---|
| 1014 | void CInterface::AttributeFortranInterfaceBody< CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1015 | { \ |
---|
| 1016 | string name_tmp=name+"__tmp"; \ |
---|
| 1017 | \ |
---|
| 1018 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1019 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1020 | { \ |
---|
[966] | 1021 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1022 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6), &" << iendl; \ |
---|
| 1023 | oss << " SIZE(" << name << "_,7)))" << iendl; \ |
---|
[932] | 1024 | oss << " " << name_tmp << " = " << name << "_" << iendl; \ |
---|
[966] | 1025 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1026 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1027 | } \ |
---|
[966] | 1028 | else { oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1029 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1030 | oss << "ENDIF"; \ |
---|
[672] | 1031 | } |
---|
[509] | 1032 | |
---|
[369] | 1033 | macro(bool) |
---|
| 1034 | macro(double) |
---|
| 1035 | macro(int) |
---|
| 1036 | |
---|
| 1037 | #undef macro |
---|
| 1038 | |
---|
[1050] | 1039 | #define macro(T)\ |
---|
| 1040 | template <>\ |
---|
| 1041 | void CInterface::AttributeFortranInterfaceBody< CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 1042 | {\ |
---|
| 1043 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1044 | oss << " CALL cxios_set_" << className << "_" << name << " &" << iendl; \ |
---|
| 1045 | oss << "(" << className << "_hdl%daddr, " << name <<"_, LEN("<<name<<"_), LEN_TRIM("<<name<< "_), SHAPE(" << name << "_))" << iendl; \ |
---|
| 1046 | oss << "ENDIF"; \ |
---|
| 1047 | } |
---|
| 1048 | |
---|
| 1049 | macro(1) |
---|
| 1050 | macro(2) |
---|
| 1051 | #undef macro |
---|
| 1052 | |
---|
[369] | 1053 | #define macro(T) \ |
---|
[672] | 1054 | template <> \ |
---|
| 1055 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,1> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1056 | { \ |
---|
| 1057 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1058 | \ |
---|
[672] | 1059 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1060 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1061 | { \ |
---|
[674] | 1062 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1)))" << iendl; \ |
---|
[966] | 1063 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1064 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1065 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1066 | } \ |
---|
[966] | 1067 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1068 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1069 | oss << "ENDIF"; \ |
---|
| 1070 | } \ |
---|
[369] | 1071 | \ |
---|
[672] | 1072 | template <> \ |
---|
| 1073 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,2> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1074 | { \ |
---|
| 1075 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1076 | \ |
---|
[672] | 1077 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1078 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1079 | { \ |
---|
[674] | 1080 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2)))" << iendl; \ |
---|
[966] | 1081 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1082 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1083 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1084 | } \ |
---|
[966] | 1085 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1086 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1087 | oss << "ENDIF"; \ |
---|
| 1088 | } \ |
---|
[932] | 1089 | \ |
---|
[672] | 1090 | template <> \ |
---|
| 1091 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,3> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1092 | { \ |
---|
| 1093 | string name_tmp=name+"__tmp"; \ |
---|
[369] | 1094 | \ |
---|
[672] | 1095 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1096 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1097 | { \ |
---|
[674] | 1098 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3)))" << iendl; \ |
---|
[966] | 1099 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1100 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[672] | 1101 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
[369] | 1102 | } \ |
---|
[966] | 1103 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1104 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[672] | 1105 | oss << "ENDIF"; \ |
---|
[932] | 1106 | } \ |
---|
| 1107 | \ |
---|
| 1108 | template <> \ |
---|
| 1109 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,4> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1110 | { \ |
---|
| 1111 | string name_tmp=name+"__tmp"; \ |
---|
| 1112 | \ |
---|
| 1113 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1114 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1115 | { \ |
---|
[966] | 1116 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1117 | oss << " SIZE(" << name << "_,4)))" << iendl; \ |
---|
| 1118 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1119 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1120 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1121 | } \ |
---|
[966] | 1122 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1123 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; }\ |
---|
[932] | 1124 | oss << "ENDIF"; \ |
---|
| 1125 | } \ |
---|
| 1126 | \ |
---|
| 1127 | template <> \ |
---|
| 1128 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,5> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1129 | { \ |
---|
| 1130 | string name_tmp=name+"__tmp"; \ |
---|
| 1131 | \ |
---|
| 1132 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1133 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1134 | { \ |
---|
[966] | 1135 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1136 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5)))" << iendl; \ |
---|
| 1137 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1138 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1139 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1140 | } \ |
---|
[966] | 1141 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1142 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1143 | oss << "ENDIF"; \ |
---|
| 1144 | }\ |
---|
| 1145 | \ |
---|
| 1146 | template <> \ |
---|
| 1147 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,6> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1148 | { \ |
---|
| 1149 | string name_tmp=name+"__tmp"; \ |
---|
| 1150 | \ |
---|
| 1151 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1152 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1153 | { \ |
---|
[966] | 1154 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1155 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6)))" << iendl; \ |
---|
| 1156 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1157 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1158 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1159 | } \ |
---|
[966] | 1160 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1161 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1162 | oss << "ENDIF"; \ |
---|
| 1163 | } \ |
---|
| 1164 | \ |
---|
| 1165 | template <> \ |
---|
| 1166 | void CInterface::AttributeFortranInterfaceGetBody< CArray<T,7> >(ostream& oss, const string& className, const string& name) \ |
---|
| 1167 | { \ |
---|
| 1168 | string name_tmp=name+"__tmp"; \ |
---|
| 1169 | \ |
---|
| 1170 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1171 | if (!matchingTypeCFortran<T>()) \ |
---|
| 1172 | { \ |
---|
[966] | 1173 | oss << " ALLOCATE(" << name_tmp << "(SIZE(" << name << "_,1), SIZE(" << name << "_,2), SIZE(" << name << "_,3), &" << iendl; \ |
---|
| 1174 | oss << " SIZE(" << name << "_,4), SIZE(" << name << "_,5), SIZE(" << name << "_,6), &" << iendl; \ |
---|
| 1175 | oss << " SIZE(" << name << "_,7)))" << iendl; \ |
---|
| 1176 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1177 | oss << "(" << className << "_hdl%daddr, " << name_tmp << ", SHAPE(" << name << "_))" << iendl; \ |
---|
[932] | 1178 | oss << " " << name << "_ = " << name_tmp << iendl; \ |
---|
| 1179 | } \ |
---|
[966] | 1180 | else { oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1181 | oss << "(" << className << "_hdl%daddr, " << name << "_, SHAPE(" << name << "_))" << iendl; } \ |
---|
[932] | 1182 | oss << "ENDIF"; \ |
---|
[672] | 1183 | } |
---|
[509] | 1184 | |
---|
[369] | 1185 | macro(bool) |
---|
| 1186 | macro(double) |
---|
| 1187 | macro(int) |
---|
| 1188 | |
---|
| 1189 | #undef macro |
---|
[1050] | 1190 | |
---|
| 1191 | #define macro(T)\ |
---|
| 1192 | template <> \ |
---|
| 1193 | void CInterface::AttributeFortranInterfaceGetBody< CArray<StdString,T> >(ostream& oss, const string& className, const string& name)\ |
---|
| 1194 | {\ |
---|
| 1195 | oss << "IF (PRESENT(" << name << "_)) THEN" << iendl; \ |
---|
| 1196 | oss << " CALL cxios_get_" << className << "_" << name << " &" << iendl; \ |
---|
| 1197 | oss << "(" << className << "_hdl%daddr, " << name << "_, LEN("<<name<<"_), SHAPE(" << name << "_))" << iendl; \ |
---|
| 1198 | oss << "ENDIF"; \ |
---|
| 1199 | } |
---|
| 1200 | macro(1) |
---|
| 1201 | macro(2) |
---|
| 1202 | macro(3) |
---|
| 1203 | macro(4) |
---|
| 1204 | macro(5) |
---|
| 1205 | macro(6) |
---|
| 1206 | macro(7) |
---|
| 1207 | |
---|
| 1208 | #undef macro |
---|
| 1209 | |
---|
[313] | 1210 | } |
---|
| 1211 | #endif |
---|