GetFEM  5.4.2
gmm_interface_bgeot.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2002-2020 Yves Renard
5 
6  This file is a part of GetFEM
7 
8  GetFEM is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version along with the GCC Runtime Library
12  Exception either version 3.1 or (at your option) any later version.
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  License and GCC Runtime Library Exception for more details.
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software Foundation,
19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, you may use this file as it is a part of a free
22  software library without restriction. Specifically, if other files
23  instantiate templates or use macros or inline functions from this file,
24  or you compile this file and link it with other files to produce an
25  executable, this file does not by itself cause the resulting executable
26  to be covered by the GNU Lesser General Public License. This exception
27  does not however invalidate any other reasons why the executable file
28  might be covered by the GNU Lesser General Public License.
29 
30 ===========================================================================*/
31 
32 /**@file gmm_interface_bgeot.h
33  @author Yves Renard <Yves.Renard@insa-lyon.fr>
34  @date October 13, 2002.
35  @brief interface for bgeot::small_vector
36 */
37 #ifndef GMM_INTERFACE_BGEOT_H__
38 #define GMM_INTERFACE_BGEOT_H__
39 
40 
41 namespace gmm {
42 
43  /* ********************************************************************* */
44  /* */
45  /* Traits for bgeot objects */
46  /* */
47  /* ********************************************************************* */
48 
49  template <typename T> struct linalg_traits<bgeot::small_vector<T> > {
50  typedef bgeot::small_vector<T> this_type;
51  typedef this_type origin_type;
52  typedef linalg_false is_reference;
53  typedef abstract_vector linalg_type;
54  typedef T value_type;
55  typedef T& reference;
56  typedef typename this_type::iterator iterator;
57  typedef typename this_type::const_iterator const_iterator;
58  typedef abstract_dense storage_type;
59  typedef linalg_true index_sorted;
60  static size_type size(const this_type &v) { return v.size(); }
61  static iterator begin(this_type &v) { return v.begin(); }
62  static const_iterator begin(const this_type &v) { return v.begin(); }
63  static iterator end(this_type &v) { return v.end(); }
64  static const_iterator end(const this_type &v) { return v.end(); }
65  static origin_type* origin(this_type &v) { return &v; }
66  static const origin_type* origin(const this_type &v) { return &v; }
67  static void clear(origin_type* o, const iterator &it, const iterator &ite)
68  { std::fill(it, ite, value_type(0)); }
69  static void do_clear(this_type &v)
70  { std::fill(v.begin(), v.end(), value_type(0)); }
71  static value_type access(const origin_type *, const const_iterator &it,
72  const const_iterator &, size_type i)
73  { return it[i]; }
74  static reference access(origin_type *, const iterator &it,
75  const iterator &, size_type i)
76  { return it[i]; }
77  static void resize(this_type &v, size_type n) { v.resize(n); }
78  };
79 
80 }
81 
82 
83 #endif // GMM_INTERFACE_BGEOT_H__
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
gmm::clear
void clear(L &l)
clear (fill with zeros) a vector or matrix.
Definition: gmm_blas.h:59
gmm::resize
void resize(V &v, size_type n)
*‍/
Definition: gmm_blas.h:209
bgeot::small_vector
container for small vectors of POD (Plain Old Data) types.
Definition: bgeot_small_vector.h:205
bgeot
Basic Geometric Tools.
Definition: bgeot_convex_ref.cc:27