Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArrayConversions_UnitTests.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 
15 #include "TestClasses.hpp"
16 
17 namespace {
18 
19 
29 using Teuchos::Array;
30 using Teuchos::ArrayView;
31 using Teuchos::Ptr;
32 using Teuchos::RCP;
33 using Teuchos::rcp;
34 using Teuchos::as;
36 
37 
38 // Verify generateArrayRcp works correctly
40 {
41  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
42  TEST_EQUALITY_CONST( as<Teuchos_Ordinal>(a_in.size()), n );
43  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
44  TEST_EQUALITY_CONST( Teuchos::is_null(a_in[i]), false );
45  TEST_EQUALITY_CONST( *a_in[i], as<T>(i) );
46  }
47 }
48 
49 
50 // Verify testArrayViewInput works correctly
52 {
53  //typedef Teuchos::ScalarTraits<T> ST; // unused
54  const Array<RCP<T> > a_data = generateArrayRcp<T>(n);
55  Array<Ptr<const T> > a_in(n);
56  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
57  a_in[i] = a_data[i].ptr();
58  }
59  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
60  TEST_EQUALITY_CONST( Teuchos::is_null(a_in[i]), false );
61  }
62  T a_out = testArrayViewInput<T>(a_in);
63  TEST_EQUALITY_CONST( a_out, as<T>(n*(n-1)/2) );
64 }
65 
66 
67 // Verify testArrayViewOutput works correctly
69 {
70  typedef Teuchos::ScalarTraits<T> ST;
71  const Array<RCP<T> > a_data = generateArrayRcp<T>(n);
72  Array<Ptr<T> > a_out;
73  a_out.reserve(n);
74  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
75  *a_data[i] = ST::zero();
76  a_out.push_back( a_data[i].ptr() );
77  }
78  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
79  TEST_EQUALITY_CONST( Teuchos::is_null(a_out[i]), false );
80  }
81  testArrayViewOutput<T>(a_out);
82  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
83  TEST_EQUALITY_CONST( *a_out[i], as<T>(i) );
84  }
85 
86 }
87 
88 
89 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_RcpNonconst_to_PtrConst, T )
90 {
91  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
92  const Array<Ptr<const T> > a_out = arrayPtrConv<const T>(a_in);
93  TEST_EQUALITY( a_out.size(), a_in.size() );
94  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
95  TEST_EQUALITY( a_out[i].get(), a_in[i].get() );
96  TEST_EQUALITY( *a_out[i], *a_in[i] );
97  }
98 }
99 
100 
101 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_RcpNonconst_to_PtrNonconst, T )
102 {
103  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
104  const Array<Ptr<T> > a_out = arrayPtrConv<T>(a_in);
105  TEST_EQUALITY( a_out.size(), a_in.size() );
106  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
107  TEST_EQUALITY( a_out[i].get(), a_in[i].get() );
108  TEST_EQUALITY( *a_out[i], *a_in[i] );
109  }
110 }
111 
112 
113 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_PtrNonconst_to_PtrNonconst, T )
114 {
115  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
116  const Array<Ptr<T> > a1_out = arrayPtrConv<T>(a_in);
117  const Array<Ptr<T> > a2_out = arrayPtrConv<T>(a1_out());
118  TEST_COMPARE_ARRAYS( a2_out, a1_out );
119 }
120 
121 
122 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_PtrNonconst_to_PtrConst, T )
123 {
124  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
125  const Array<Ptr<T> > a1_out = arrayPtrConv<T>(a_in);
126  const Array<Ptr<const T> > a2_out = arrayPtrConv<const T>(a1_out());
127  TEST_COMPARE_ARRAYS( a2_out, a1_out );
128 }
129 
130 
131 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_PtrConst_to_PtrConst, T )
132 {
133  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
134  const Array<Ptr<const T> > a1_out = arrayPtrConv<const T>(a_in);
135  const Array<Ptr<const T> > a2_out = arrayPtrConv<const T>(a1_out());
136  TEST_COMPARE_ARRAYS( a2_out, a1_out );
137 }
138 
139 
140 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_PassConst, T )
141 {
142  Array<RCP<T> > a_in = generateArrayRcp<T>(n);
143  T a = testArrayViewInput<T>(arrayPtrConv<const T>(a_in));
144  T a_exact = as<T>(n*(n-1)/2);
145  TEST_EQUALITY( a, a_exact );
146 }
147 
148 
149 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayPtrConv_PassNonconst, T )
150 {
151  typedef Teuchos::ScalarTraits<T> ST;
152  Array<RCP<T> > a_out = generateArrayRcp<T>(n);
153  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
154  *a_out[i] = ST::zero();
155  }
156  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
157  TEST_EQUALITY_CONST( *a_out[i], ST::zero() );
158  }
159  testArrayViewOutput<T>(arrayPtrConv<T>(a_out));
160  TEST_EQUALITY_CONST( as<Teuchos_Ordinal>(a_out.size()), n );
161  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
162  TEST_EQUALITY_CONST( *a_out[i], as<T>(i) );
163  }
164 }
165 
166 
167 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayRcpConv_RcpNonconst_to_RcpNonconst, T )
168 {
169  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
170  const Array<RCP<T> > a1_out = arrayRcpConv<T>(a_in);
171  TEST_COMPARE_ARRAYS( a1_out, a_in );
172 }
173 
174 
175 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayRcpConv_RcpNonconst_to_RcpConst, T )
176 {
177  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
178  const Array<RCP<const T> > a1_out = arrayRcpConv<const T>(a_in);
179  TEST_COMPARE_ARRAYS( a1_out, a_in );
180 }
181 
182 
183 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayRcpConv_RcpConst_to_RcpConst, T )
184 {
185  const Array<RCP<T> > a_in = generateArrayRcp<T>(n);
186  const Array<RCP<const T> > a1_out = arrayRcpConv<const T>(a_in);
187  const Array<RCP<const T> > a2_out = arrayRcpConv<const T>(a1_out);
188  TEST_COMPARE_ARRAYS( a2_out, a1_out );
189 }
190 
191 
192 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayConstPtrConstCast_nonconst_to_const,
193  T )
194 {
195  Array<RCP<T> > a_rcp = generateArrayRcp<T>(n);
196  Array<Ptr<T> > a_ptr = arrayPtrConv<T>(a_rcp);
197  const ArrayView<const Ptr<T> > av_ptr_nonconst = a_ptr();
198  const ArrayView<const Ptr<const T> > av_ptr_const =
199  Teuchos::arrayConstPtrConstCast(av_ptr_nonconst);
200  TEST_COMPARE_ARRAYS( av_ptr_nonconst, av_ptr_const );
201 }
202 
203 
204 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayConstPtrConstCast_const_to_const,
205  T )
206 {
207  Array<RCP<T> > a_rcp = generateArrayRcp<T>(n);
208  Array<Ptr<const T> > a_ptr = arrayPtrConv<const T>(a_rcp);
209  const ArrayView<const Ptr<const T> > av_ptr_const1 = a_ptr();
210  const ArrayView<const Ptr<const T> > av_ptr_const2 =
211  Teuchos::arrayConstPtrConstCast(av_ptr_const1);
212  TEST_COMPARE_ARRAYS( av_ptr_const1, av_ptr_const2 );
213 }
214 
215 
216 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayConstRcpConstCast_nonconst_to_const,
217  T )
218 {
219  Array<RCP<T> > a_rcp = generateArrayRcp<T>(n);
220  const ArrayView<const RCP<T> > av_rcp_nonconst = a_rcp();
221  const ArrayView<const RCP<const T> > av_rcp_const =
222  Teuchos::arrayConstRcpConstCast(av_rcp_nonconst);
223  TEST_COMPARE_ARRAYS( av_rcp_nonconst, av_rcp_const );
224 }
225 
226 
227 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayConversions, arrayConstRcpConstCast_const_to_const,
228  T )
229 {
230  Array<RCP<T> > a_rcp_orig = generateArrayRcp<T>(n);
231  Array<RCP<const T> > a_rcp = arrayRcpConv<const T>(a_rcp_orig);
232  const ArrayView<const RCP<const T> > av_rcp_const1 = a_rcp();
233  const ArrayView<const RCP<const T> > av_rcp_const2 =
234  Teuchos::arrayConstRcpConstCast(av_rcp_const1);
235  TEST_COMPARE_ARRAYS( av_rcp_const1, av_rcp_const2 );
236 }
237 
238 
239 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
240 
241 # define DEBUG_UNIT_TEST_GROUP( T )
242 
243 #else // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
244 
245 # define DEBUG_UNIT_TEST_GROUP( T )
246 
247 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
248 
249 #define UNIT_TEST_GROUP( T ) \
250  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, generateArrayRcp, T ) \
251  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, testArrayViewInput, T ) \
252  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, testArrayViewOutput, T ) \
253  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_RcpNonconst_to_PtrConst, T ) \
254  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_RcpNonconst_to_PtrNonconst, T ) \
255  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_PtrNonconst_to_PtrNonconst, T ) \
256  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_PtrNonconst_to_PtrConst, T ) \
257  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_PtrConst_to_PtrConst, T ) \
258  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayRcpConv_RcpConst_to_RcpConst, T ) \
259  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_PassConst, T ) \
260  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayPtrConv_PassNonconst, T ) \
261  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayRcpConv_RcpNonconst_to_RcpNonconst, T ) \
262  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayRcpConv_RcpNonconst_to_RcpConst, T ) \
263  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayConstPtrConstCast_nonconst_to_const, T ) \
264  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayConstPtrConstCast_const_to_const, T ) \
265  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayConstRcpConstCast_nonconst_to_const, T ) \
266  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayConversions, arrayConstRcpConstCast_const_to_const, T ) \
267  DEBUG_UNIT_TEST_GROUP( T )
268 
269 
271 UNIT_TEST_GROUP(float)
272 UNIT_TEST_GROUP(double)
273 
274 
275 
276 TEUCHOS_UNIT_TEST( ArrayConversions, arrayPtrConv_RcpNonconstDerived_to_PtrNonconstBase)
277 {
278  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
279  const Array<Ptr<A> > a_out = arrayPtrConv<A>(a_in);
280  TEST_EQUALITY( a_out.size(), a_in.size() );
281  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
282  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
283  }
284 }
285 
286 
287 TEUCHOS_UNIT_TEST( ArrayConversions, arrayPtrConv_RcpNonconstDerived_to_PtrConstBase)
288 {
289  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
290  const Array<Ptr<const A> > a_out = arrayPtrConv<const A>(a_in);
291  TEST_EQUALITY( a_out.size(), a_in.size() );
292  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
293  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<const A>(&*a_in[i]) );
294  }
295 }
296 
297 
298 TEUCHOS_UNIT_TEST( ArrayConversions, arrayPtrConv_RcpConstDerived_to_PtrConstBase)
299 {
300  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
301  const Array<RCP<const C> > a1_out = arrayRcpConv<const C>(a_in);
302  const Array<Ptr<const A> > a2_out = arrayPtrConv<const A>(a1_out);
303  TEST_EQUALITY( a2_out.size(), a_in.size() );
304  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
305  TEST_EQUALITY( &*a2_out[i], implicit_ptr_cast<const A>(&*a_in[i]) );
306  }
307 }
308 
309 
310 TEUCHOS_UNIT_TEST( ArrayConversions, arrayRcpConv_RcpNonconstDerived_to_RcpNonconstBase)
311 {
312  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
313  const Array<RCP<A> > a_out = arrayRcpConv<A>(a_in);
314  TEST_EQUALITY( a_out.size(), a_in.size() );
315  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
316  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
317  }
318 }
319 
320 
321 TEUCHOS_UNIT_TEST( ArrayConversions, arrayRcpConv_RcpNonconstDerived_to_RcpConstBase)
322 {
323  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
324  const Array<RCP<const A> > a_out = arrayRcpConv<const A>(a_in);
325  TEST_EQUALITY( a_out.size(), a_in.size() );
326  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
327  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
328  }
329 }
330 
331 
332 TEUCHOS_UNIT_TEST( ArrayConversions, arrayRcpConv_RcpConstDerived_to_RcpConstBase)
333 {
334  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
335  const Array<RCP<const C> > a1_out = arrayRcpConv<const C>(a_in);
336  const Array<RCP<const A> > a2_out = arrayRcpConv<const A>(a1_out);
337  TEST_EQUALITY( a2_out.size(), a_in.size() );
338  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
339  TEST_EQUALITY( &*a2_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
340  }
341 }
342 
343 
344 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewPtrConv_RcpNonconstDerived_to_PtrNonconstBase)
345 {
346  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
347  Array<Ptr<A> > a_out(n);
348  arrayViewPtrConv(a_in, a_out());
349  TEST_EQUALITY( a_out.size(), a_in.size() );
350  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
351  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
352  }
353 }
354 
355 
356 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewPtrConv_RcpNonconstDerived_to_PtrConstBase)
357 {
358  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
359  Array<Ptr<const A> > a_out(n);
360  arrayViewPtrConv(a_in, a_out());
361  TEST_EQUALITY( a_out.size(), a_in.size() );
362  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
363  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<const A>(&*a_in[i]) );
364  }
365 }
366 
367 
368 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewPtrConv_RcpConstDerived_to_PtrConstBase)
369 {
370  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
371  Array<RCP<const C> > a1_out(n);
372  arrayViewRcpConv(a_in, a1_out());
373  Array<Ptr<const A> > a2_out(n);
374  arrayViewPtrConv(a1_out, a2_out());
375  TEST_EQUALITY( a2_out.size(), a_in.size() );
376  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
377  TEST_EQUALITY( &*a2_out[i], implicit_ptr_cast<const A>(&*a_in[i]) );
378  }
379 }
380 
381 
382 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewRcpConv_RcpNonconstDerived_to_RcpNonconstBase)
383 {
384  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
385  Array<RCP<A> > a_out(n);
386  arrayViewRcpConv(a_in, a_out());
387  TEST_EQUALITY( a_out.size(), a_in.size() );
388  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
389  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
390  }
391 }
392 
393 
394 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewRcpConv_RcpNonconstDerived_to_RcpConstBase)
395 {
396  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
397  Array<RCP<const A> > a_out(n);
398  arrayViewRcpConv(a_in, a_out());
399  TEST_EQUALITY( a_out.size(), a_in.size() );
400  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
401  TEST_EQUALITY( &*a_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
402  }
403 }
404 
405 
406 TEUCHOS_UNIT_TEST( ArrayConversions, arrayViewRcpConv_RcpConstDerived_to_RcpConstBase)
407 {
408  const Array<RCP<C> > a_in = generateArrayRcpGen<C>(n);
409  Array<RCP<const C> > a1_out(n);
410  arrayViewRcpConv(a_in, a1_out());
411  Array<RCP<const A> > a2_out(n);
412  arrayViewRcpConv(a1_out, a2_out());
413  TEST_EQUALITY( a2_out.size(), a_in.size() );
414  for (Teuchos_Ordinal i=0 ; i<n ; ++i) {
415  TEST_EQUALITY( &*a2_out[i], implicit_ptr_cast<A>(&*a_in[i]) );
416  }
417 }
418 
419 
420 } // namespace
T testArrayViewInput(const ArrayView< const Ptr< const T > > &a_in)
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
Array< RCP< T_out > > arrayRcpConv(const ArrayPtrT_in &a_in)
Utility function to convert any Array[View,RCP]&lt;[const] RCP&lt;T_in&gt; &gt; object to an Array&lt;RCP&lt;T_out&gt; &gt; o...
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
Macro for defining a templated unit test with one template parameter.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
void arrayViewPtrConv(const ArrayPtrT_in &a_in, const ArrayView< Ptr< T_out > > &a_out)
Utility function to convert from an an input Array[View,RCP]&lt;[const] PTR&lt;T_in&gt; &gt; object to an output ...
This structure defines some basic traits for a scalar field type.
TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
void arrayViewRcpConv(const ArrayPtrT_in &a_in, const ArrayView< RCP< T_out > > &a_out)
Utility function to convert from an input Array[View,RCP]&lt;[const] RCP&lt;T_in&gt; &gt; object to an output Arr...
ArrayView< const RCP< const T > > arrayConstRcpConstCast(const ArrayView< const RCP< T > > &a_in)
Utility function that does a reinterpret case to convert an ArrayView&lt;const RCP&lt;T&gt; &gt; object to an Arr...
TypeTo * implicit_ptr_cast(TypeFrom *t)
Perform an implicit cast of pointer types with a pointer being returned.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
Ptr< T > ptr(T *p)
Create a pointer to an object from a raw pointer.
Templated conversions between Array&lt;RCP&lt;T&gt; &gt; and ArrayView&lt;Ptr&lt;T&gt; &gt;
void testArrayViewOutput(const ArrayView< const Ptr< T > > &a_out)
#define TEST_COMPARE_ARRAYS(a1, a2)
Assert that a1.size()==a2.size() and a[i]==b[i], i=0....
Nonowning array view.
Array< Ptr< T_out > > arrayPtrConv(const ArrayPtrT_in &a_in)
Utility function to convert an Array[View,RCP]&lt;[const] PTR&lt;T_in&gt; &gt; object to an Array&lt;Ptr&lt;T_out&gt; &gt; ob...
Array< RCP< T > > generateArrayRcp(const Teuchos_Ordinal n_in)
Smart reference counting pointer class for automatic garbage collection.
ArrayView< const Ptr< const T > > arrayConstPtrConstCast(const ArrayView< const Ptr< T > > &a_in)
Utility function that does a reinterpret case to convert an ArrayView&lt;const Ptr&lt;T&gt; &gt; object to an Arr...
#define UNIT_TEST_GROUP(T)
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
Array< RCP< T > > generateArrayRcpGen(const Teuchos_Ordinal n_in)
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...