1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 //                         Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA  02110-1301  USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 #ifndef ANTIOCH_VECTOR_UTILS_DECL_H
28 #define ANTIOCH_VECTOR_UTILS_DECL_H
29 
30 #ifdef ANTIOCH_METAPROGRAMMING_H
31 #  error vector_utils_decl.h must be included before metaprogramming.h
32 #endif
33 
34 // Antioch
35 #include "antioch/metaprogramming_decl.h"
36 
37 // C++
38 #include <iostream>
39 #include <vector>
40 
41 // Add some overloads
42 
43 namespace std
44 {
45 
46 template <typename T>
47 inline
48 std::ostream&
49 operator<< (std::ostream& output, const std::vector<T>& a);
50 
51 template <typename T>
52 inline
53 std::vector<T>
54 operator* (const std::vector<T>& src, const T & mul);
55 
56 template <typename T>
57 inline
58 std::vector<T>
59 operator/ (const std::vector<T>& src, const T & mul);
60 
61 } // end namespace std
62 
63 namespace Antioch
64 {
65 
66 // Class to allow tag dispatching to std::vector specializations
67 struct vector_library_tag : public numeric_library_tag {};
68 
69 template <typename T, typename NewScalar>
70 struct rebind<std::vector<T>, NewScalar>;
71 
72 template <typename T>
73 struct has_size<std::vector<T> >;
74 
75 template <typename T>
76 struct return_auto<std::vector<T> >;
77 
78 template <typename T>
79 struct size_type<std::vector<T> >;
80 
81 template <typename T>
82 struct value_type<std::vector<T> >;
83 
84 template <typename T>
85 struct raw_value_type<std::vector<T> >;
86 
87 template <typename T>
88 inline
89 std::vector<T>
90 zero_clone(const std::vector<T>& example);
91 
92 template <typename T1, typename T2>
93 inline
94 void
95 zero_clone(std::vector<T1>& output, const std::vector<T2>& example);
96 
97 template <typename T, typename Scalar>
98 inline
99 std::vector<T>
100 constant_clone(const std::vector<T>& example, const Scalar& value);
101 
102 // A function for zero-setting vectorized numeric types
103 template <typename T>
104 inline
105 void set_zero(std::vector<T>& a);
106 
107 template <typename T, typename VectorScalar>
108 inline
109 std::vector<T> custom_clone(const std::vector<T> & vec, const VectorScalar & vecsrc, const std::vector<unsigned int> & indexes);
110 
111 } // end namespace Antioch
112 
113 
114 #endif //ANTIOCH_VECTOR_UTILS_DECL_H
115