Skip to content
Snippets Groups Projects
Select Git revision
  • 551530658fa43c19fd4d86748dd24950380750be
  • develop default protected
  • feature/variational-hydro
  • origin/stage/bouguettaia
  • feature/gmsh-reader
  • feature/reconstruction
  • save_clemence
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

utils

  • Clone with SSH
  • Clone with HTTPS
  • Stephane Del Pino's avatar
    Stéphane Del Pino authored
    "Array<another_data_type>" is actually (CastArray<another_data_type>).  This is
    in fact just a view which allow to access/modify original array's data
    reinterpreting them to another type.
    
    The only constrain w.r. to the type is that one must have
    sizeof(data_type)*Array::size() == sizeof(other_data_type)*CastArray::size().
    
    CastArray can be built thanks to the helper static function
    cast_array_to<other_data_type>::from(given_array).
    
    Usage: for instance, one writes:
    
    Array<double> x(3); x[0]=1;x[1]=2;x[2]=3;
    CastArray y = cast_array_to<int>::from(x);        // ok! y values can change
    CastArray z = cast_array_to<const int>::from(x);  // ok! z values cannot change
    
    Array<const double> cx = x;
    CastArray cy = cast_array_to<int>::from(cx);      // invalid! cannot remove const
    CastArray cz = cast_array_to<const int>::from(cx);// ok!
    
    CastArray t = cast_array_to<TinyVector<4,int>>::from(x); // ok!
    
    In last example, execution will fail (sizes are incompatible), but would success
    if the size of x was a multiple of 2.
    
    It is unclear if one should impose sizeof(other_data_type) <= sizeof(data_type)
    55153065
    History