本文整理汇总了C++中tl::Type::is_fortran_array方法的典型用法代码示例。如果您正苦于以下问题:C++ Type::is_fortran_array方法的具体用法?C++ Type::is_fortran_array怎么用?C++ Type::is_fortran_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tl::Type
的用法示例。
在下文中一共展示了Type::is_fortran_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DIMENSION
static TL::Symbol create_initializer_function_fortran(
OpenMP::Reduction* red,
TL::Type reduction_type,
Nodecl::NodeclBase construct)
{
std::string fun_name;
{
std::stringstream ss;
ss << "nanos_ini_" << red << "_" << reduction_type.get_internal_type() << "_" << simple_hash_str(construct.get_filename().c_str());
fun_name = ss.str();
}
Nodecl::NodeclBase initializer = red->get_initializer().shallow_copy();
TL::Type omp_out_type = reduction_type,
omp_ori_type = reduction_type;
// These sources are only used in array reductions
TL::Source omp_out_extra_attributes,
extra_stuff_array_red;
if (reduction_type.is_array())
{
Source dims_descr;
TL::Type t = reduction_type;
int rank = 0;
if (t.is_fortran_array())
{
rank = t.fortran_rank();
}
dims_descr << "(";
omp_out_extra_attributes << ", POINTER, DIMENSION(";
int i;
for (i = 0; i < rank; i++)
{
if (i != 0)
{
dims_descr << ",";
omp_out_extra_attributes << ",";
}
dims_descr << "LBOUND(omp_orig, DIM = " << (rank - i) << ")"
<< ":"
<< "UBOUND(omp_orig, DIM = " << (rank - i) << ")"
;
omp_out_extra_attributes << ":";
t = t.array_element();
}
dims_descr << ")";
omp_out_extra_attributes << ")";
omp_out_type = t;
extra_stuff_array_red << "ALLOCATE(omp_out" << dims_descr <<")\n";
}
Source src;
src << "SUBROUTINE " << fun_name << "(omp_out, omp_orig)\n"
<< "IMPLICIT NONE\n"
<< as_type(omp_out_type) << omp_out_extra_attributes << " :: omp_out\n"
<< as_type(omp_ori_type) << " :: omp_orig\n"
<< extra_stuff_array_red
<< "omp_out = " << as_expression(initializer) << "\n"
<< "END SUBROUTINE " << fun_name << "\n"
;
TL::Scope global_scope = construct.retrieve_context().get_global_scope();
Nodecl::NodeclBase function_code = src.parse_global(global_scope);
TL::Symbol function_sym = global_scope.get_symbol_from_name(fun_name);
ERROR_CONDITION(!function_sym.is_valid(), "Symbol %s not found", fun_name.c_str());
// As the initializer function is needed during the instantiation of
// the task, this function should be inserted before the construct
Nodecl::Utils::prepend_to_enclosing_top_level_location(construct,
function_code);
return function_sym;
}