/usr/include/trilinos/Phalanx_MDField_Def.hpp is in libtrilinos-phalanx-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | // @HEADER
// ************************************************************************
//
// Phalanx: A Partial Differential Equation Field Evaluation
// Kernel for Flexible Management of Complex Dependency Chains
// Copyright 2008 Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Roger Pawlowski (rppawlo@sandia.gov), Sandia
// National Laboratories.
//
// ************************************************************************
// @HEADER
#ifndef PHX_MDFIELD_DEF_HPP
#define PHX_MDFIELD_DEF_HPP
#include <algorithm>
#include <sstream>
#include <vector>
#include "Teuchos_Assert.hpp"
#include "Teuchos_TypeNameTraits.hpp"
#include "Phalanx_config.hpp"
#include "Phalanx_Print_Utilities.hpp"
//**********************************************************************
#ifdef PHX_DEBUG
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
const std::string PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::m_field_tag_error_msg =
"Error - PHX::MDField - No tag has been set!";
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
const std::string PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::m_field_data_error_msg =
"Error - PHX::MDField - No data has been set! Please bind memory (call getFieldData()) to MDField!";
template<typename DataT>
const std::string PHX::MDField<DataT>::m_field_tag_error_msg =
"Error - PHX::MDField - No tag has been set!";
template<typename DataT>
const std::string PHX::MDField<DataT>::m_field_data_error_msg =
"Error - PHX::MDField - No data has been set! Please bind memory (call getFieldData()) to MDField!";
#endif
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
MDField(const std::string& name, const Teuchos::RCP<const PHX::DataLayout>& t) :
m_tag(name,t)
#ifdef PHX_DEBUG
, m_tag_set(true),
m_data_set(false)
#endif
{ }
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
MDField(const PHX::Tag<DataT>& v) :
m_tag(v)
#ifdef PHX_DEBUG
,m_tag_set(true),
m_data_set(false)
#endif
{ }
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
MDField() :
m_tag("???", Teuchos::null)
#ifdef PHX_DEBUG
,m_tag_set(false),
m_data_set(false)
#endif
{ }
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename CopyDataT,
typename T0, typename T1, typename T2,
typename T3, typename T4, typename T5,
typename T6, typename T7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
MDField(const MDField<CopyDataT,T0,T1,T2,T3,T4,T5,T6,T7>& source) :
m_tag(source.m_tag),
m_field_data(source.m_field_data)
#ifdef PHX_DEBUG
,m_tag_set(source.m_tag_set),
m_data_set(source.m_data_set)
#endif
{
static_assert(ArrayRank == std::decay<decltype(source)>::type::ArrayRank,
"ERROR: Compiletime MDField copy ctor requires rank to be the same!");
static_assert(std::is_same<typename std::decay<DataT>::type, typename std::decay<CopyDataT>::type>::value,
"ERROR: Compiletime MDField copy ctor requires scalar types to be the same!");
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
~MDField()
{ }
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
const PHX::FieldTag&
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
fieldTag() const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_tag_set, std::logic_error, m_field_tag_error_msg);
#endif
return m_tag;
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename CopyDataT,
typename T0, typename T1, typename T2,
typename T3, typename T4, typename T5,
typename T6, typename T7>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>&
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator=(const MDField<CopyDataT,T0,T1,T2,T3,T4,T5,T6,T7>& source)
{
m_tag = source.m_tag;
m_field_data = source.m_field_data;
#ifdef PHX_DEBUG
m_tag_set = source.m_tag_set;
m_data_set = source.m_data_set;
#endif
static_assert(ArrayRank == std::decay<decltype(source)>::type::ArrayRank,
"ERROR: Compiletime MDField assignment operator requires rank to be the same!");
static_assert(std::is_same<typename std::decay<DataT>::type, typename std::decay<CopyDataT>::type>::value,
"ERROR: Compiletime MDField assignment operator requires scalar types to be the same!");
return *this;
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2, typename iType3,
typename iType4, typename iType5, typename iType6, typename iType7>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2,
iType3 index3, iType4 index4, iType5 index5,
iType6 index6, iType7 index7) const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2,index3,index4,index5,index6,index7);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2, typename iType3,
typename iType4, typename iType5, typename iType6>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2,
iType3 index3, iType4 index4, iType5 index5,
iType6 index6)const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2,index3,index4,index5,index6);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2, typename iType3,
typename iType4, typename iType5>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2,
iType3 index3, iType4 index4, iType5 index5)const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2,index3,index4,index5);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2, typename iType3,
typename iType4>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2,
iType3 index3, iType4 index4)const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2,index3,index4);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2, typename iType3>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2,
iType3 index3)const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2,index3);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1, typename iType2>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1, iType2 index2) const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1,index2);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0, typename iType1>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index0, iType1 index1) const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index0,index1);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType0>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDFieldTypeTraits<typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type>::return_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
operator()(iType0 index1) const
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
return m_field_data(index1);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::size_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
rank() const
{
return m_field_data.Rank;
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::size_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
dimension(const iType& ord) const
{
return m_field_data.dimension(ord);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename iType>
void PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
dimensions(std::vector<iType>& dims)
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_tag_set, std::logic_error, m_field_tag_error_msg);
TEUCHOS_TEST_FOR_EXCEPTION(!m_data_set, std::logic_error, m_field_data_error_msg);
#endif
dims.resize(m_field_data.Rank);
for ( size_type i = 0 ; i < m_field_data.Rank; ++i )
dims[i] = static_cast<iType>(m_field_data.dimension(i)); // dangerous
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::size_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::size() const
{
return m_field_data.size();
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
void PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
setFieldTag(const PHX::Tag<DataT>& v)
{
#ifdef PHX_DEBUG
m_tag_set = true;
#endif
m_tag = v;
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
void PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
setFieldData(const PHX::any& a)
{
#if defined( PHX_DEBUG) && !defined (__CUDA_ARCH__ )
TEUCHOS_TEST_FOR_EXCEPTION(!m_tag_set, std::logic_error, m_field_tag_error_msg);
m_data_set = true;
#endif
// any object is always the non-const data type. To correctly cast
// the any object to the Kokkos::View, need to pull the const off
// the scalar type if this MDField has a const scalar type.
typedef Kokkos::View<typename array_type::non_const_data_type,PHX::Device> non_const_view;
try {
non_const_view tmp = PHX::any_cast<non_const_view>(a);
m_field_data = tmp;
}
catch (std::exception& e) {
std::cout << "\n\nError in compiletime PHX::MDField::setFieldData() in PHX::any_cast. Tried to cast the field \""
<< this->fieldTag().name() << "\" with the identifier \"" << this->fieldTag().identifier()
<< "\" to a type of \"" << Teuchos::demangleName(typeid(non_const_view).name())
<< "\" from a PHX::any object containing a type of \""
<< Teuchos::demangleName(a.type().name()) << "\"." << std::endl;
throw;
}
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
void PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
print(std::ostream& os, bool printValues) const
{
std::vector<const char*> dim_names;
PHX::PrintDimension<Tag0,array_type> pd0;
pd0.addName(dim_names);
PHX::PrintDimension<Tag1,array_type> pd1;
pd1.addName(dim_names);
PHX::PrintDimension<Tag2,array_type> pd2;
pd2.addName(dim_names);
PHX::PrintDimension<Tag3,array_type> pd3;
pd3.addName(dim_names);
PHX::PrintDimension<Tag4,array_type> pd4;
pd4.addName(dim_names);
PHX::PrintDimension<Tag5,array_type> pd5;
pd5.addName(dim_names);
PHX::PrintDimension<Tag6,array_type> pd6;
pd6.addName(dim_names);
PHX::PrintDimension<Tag7,array_type> pd7;
pd7.addName(dim_names);
os << "MDField<";
for (std::size_t i=0; i < dim_names.size(); ++i) {
if (i > 0)
os << ",";
os << std::string(dim_names[i]);
}
os << ">(";
for (std::size_t i=0; i < dim_names.size(); ++i) {
if (i > 0)
os << ",";
os << m_field_data.dimension(i);
}
os << "): ";
os << m_tag;
if (printValues)
os << "Error - MDField no longer supports the \"printValues\" member of the MDField::print() method. Values may be on a device that does not support printing (e.g. GPU). Please disconstinue the use of this call!" << std::endl;
}
//*********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
Kokkos::DynRankView<DataT,PHX::Device>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
get_view()
{
return m_field_data;
}
//*********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
const Kokkos::DynRankView<DataT,PHX::Device>
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
get_view() const
{
return m_field_data;
}
//*********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
get_static_view()
{
return m_field_data;
}
//*********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
KOKKOS_FORCEINLINE_FUNCTION
const typename PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::array_type
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
get_static_view() const
{
return m_field_data;
}
//*********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
template<typename SrcDataT,
typename SrcTag0,typename SrcTag1, typename SrcTag2, typename SrcTag3,
typename SrcTag4,typename SrcTag5, typename SrcTag6, typename SrcTag7>
void
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
deep_copy(const PHX::MDField<SrcDataT,SrcTag0,SrcTag1,SrcTag2,SrcTag3,
SrcTag4,SrcTag5,SrcTag6,SrcTag7>& source)
{
Kokkos::deep_copy(m_field_data, source.get_static_view());
}
//*************************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
void
PHX::MDField<DataT,Tag0,Tag1,Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>::
deep_copy(const DataT source)
{
Kokkos::deep_copy(m_field_data, source);
}
//**********************************************************************
template<typename DataT,
typename Tag0,typename Tag1, typename Tag2, typename Tag3,
typename Tag4,typename Tag5, typename Tag6, typename Tag7>
std::ostream& PHX::operator<<(std::ostream& os,
const PHX::MDField<DataT,Tag0,Tag1,
Tag2,Tag3,Tag4,Tag5,Tag6,Tag7>& f)
{
f.print(os, false);
return os;
}
//**********************************************************************
//**********************************************************************
//**********************************************************************
// Runtime Version
//**********************************************************************
//**********************************************************************
#include "Phalanx_MDField_DynRank_Def.hpp"
#endif
|