Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:01

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP
0012 #define BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP
0013 
0014 #include <vtkMatrix4x4.h>
0015 
0016 #include <boost/compute/types/fundamental.hpp>
0017 
0018 namespace boost {
0019 namespace compute {
0020 
0021 /// Converts a \c vtkMatrix4x4 to a \c float16_.
0022 inline float16_ vtk_matrix4x4_to_float16(const vtkMatrix4x4 *matrix)
0023 {
0024     float16_ result;
0025 
0026     for(int i = 0; i < 4; i++){
0027         for(int j = 0; j < 4; j++){
0028             result[i*4+j] = matrix->GetElement(i, j);
0029         }
0030     }
0031 
0032     return result;
0033 }
0034 
0035 /// Converts a \c vtkMatrix4x4 to a \c double16_;
0036 inline double16_ vtk_matrix4x4_to_double16(const vtkMatrix4x4 *matrix)
0037 {
0038     double16_ result;
0039     std::memcpy(&result, matrix->Element, 16 * sizeof(double));
0040     return result;
0041 }
0042 
0043 } // end compute namespace
0044 } // end boost namespace
0045 
0046 #endif // BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP