/* * (C) Copyright 2013 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. * In applying this licence, ECMWF does not waive the privileges and immunities * granted to it by virtue of its status as an intergovernmental organisation * nor does it submit to any jurisdiction. */ /// @file IndexView.h /// This file contains the IndexView class, a class that allows to wrap any /// contiguous raw data into /// a view which is accessible with multiple indices. /// This view is intended to work with Connectivity Tables storing Fortran /// Numbering internally /// All it needs is the strides for each index, and the shape of each index. /// ATTENTION: The last index is stride 1 /// /// Bounds-checking can be turned ON by defining /// "ATLAS_INDEXVIEW_BOUNDS_CHECKING" /// before including this header. /// /// Example: /// int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9}; /// idx_t[2] strides = { 3, 1 }; /// idx_t[2] shape = { 3, 3 }; /// IndexView matrix( array, strides, shape ); /// for( idx_t i=0; i fieldview( Field ); /// IndexView INDEXVIEW( Array ); #pragma once #include "atlas/library/config.h" #if ATLAS_HAVE_GRIDTOOLS_STORAGE #include "atlas/array/gridtools/GridToolsIndexView.h" #else #include "atlas/array/native/NativeIndexView.h" #endif