Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
AlephCudaVector.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* cnc_vector.h (C) 2000-2012 */
9/* */
10/*---------------------------------------------------------------------------*/
11/*---------------------------------------------------------------------------*/
12#ifndef _CNC_INTERFACE_VECTOR_H_
13#define _CNC_INTERFACE_VECTOR_H_
14
15namespace Arcane
16{
17template <class T> class CNC_Vector
18{
19 public:
20
21 typedef CNC_Vector<T> thisclass;
22
23 CNC_Vector(unsigned int size = 0, unsigned int alignment = 1);
24
25 ~CNC_Vector();
26
27 //---------------------------------------------------------------------------//
28
30 void allocate(unsigned int size, unsigned int alignment = 1);
31
32 //---------------------------------------------------------------------------//
33
34 void set_all(const T& value);
35
36 //---------------------------------------------------------------------------//
37
38 T& operator()(unsigned int i);
39 //---------------------------------------------------------------------------//
40
41 const T& operator()(unsigned int i) const;
42
43 //---------------------------------------------------------------------------//
44
45 T& operator[](unsigned int index);
46 //---------------------------------------------------------------------------//
47
48 const T& operator[](unsigned int index) const;
49
50 //---------------------------------------------------------------------------//
51
52 T& from_linear_index(unsigned int index);
53
54 //---------------------------------------------------------------------------//
55
56 const T& from_linear_index(unsigned int index) const;
57 //---------------------------------------------------------------------------//
58
59 unsigned int size() const;
60
61 //---------------------------------------------------------------------------//
62
63 unsigned int alignment() const;
64
65 //---------------------------------------------------------------------------//
66
67 void clear();
68
69 //---------------------------------------------------------------------------//
70
72 const T* data() const;
73
74 //---------------------------------------------------------------------------//
75
77 T* data();
78
79 //---------------------------------------------------------------------------//
80
81 unsigned int mem_usage() const;
82 //---------------------------------------------------------------------------//
83
84 void print() const;
85
86 //---------------------------------------------------------------------------//
87
88 protected:
89
90 T* data_;
91 unsigned int size_;
92 char* base_mem_;
93 unsigned int alignment_;
94
95 //---------------------------------------------------------------------------//
96
97 void deallocate();
98
99 //---------------------------------------------------------------------------//
100
101 private:
102
103 CNC_Vector(const thisclass& rhs);
104 thisclass& operator=(const thisclass& rhs);
105};
106
107} // namespace Arcane
108
109#endif
void allocate(unsigned int size, unsigned int alignment=1)
const T * data() const
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --