-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// ops_abs.hpp | ||
// Pressio | ||
// Copyright 2019 | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, the | ||
// U.S. Government retains certain rights in this software. | ||
// | ||
// Pressio is licensed under BSD-3-Clause terms of use: | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived | ||
// from this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Francesco Rizzi ([email protected]) | ||
// | ||
// ************************************************************************ | ||
//@HEADER | ||
*/ | ||
|
||
#ifndef PRESSIOOPS_OPS_EPETRA_OPS_ABS_HPP_ | ||
#define PRESSIOOPS_OPS_EPETRA_OPS_ABS_HPP_ | ||
|
||
namespace pressio{ namespace ops{ | ||
|
||
// y= abs(x) | ||
template <typename T1, class T2> | ||
std::enable_if_t< | ||
::pressio::is_vector_epetra<T1>::value | ||
&& ::pressio::is_vector_epetra<T2>::value | ||
> | ||
abs(T1 & y, const T2 & x) | ||
{ | ||
assert(::pressio::ops::extent(y, 0) == ::pressio::ops::extent(x, 0)); | ||
|
||
y.Abs(x); | ||
} | ||
|
||
}}//end namespace pressio::ops | ||
#endif // PRESSIOOPS_OPS_EPETRA_OPS_ABS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// ops_clone.hpp | ||
// Pressio | ||
// Copyright 2019 | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, the | ||
// U.S. Government retains certain rights in this software. | ||
// | ||
// Pressio is licensed under BSD-3-Clause terms of use: | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived | ||
// from this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Francesco Rizzi ([email protected]) | ||
// | ||
// ************************************************************************ | ||
//@HEADER | ||
*/ | ||
|
||
#ifndef PRESSIOOPS_OPS_EPETRA_OPS_CLONE_HPP_ | ||
#define PRESSIOOPS_OPS_EPETRA_OPS_CLONE_HPP_ | ||
|
||
namespace pressio{ namespace ops{ | ||
|
||
|
||
template <typename T> | ||
std::enable_if_t< | ||
(::pressio::is_vector_epetra<T>::value | ||
|| ::pressio::is_multi_vector_epetra<T>::value), T> | ||
clone(const T & clonable) | ||
{ | ||
return T(clonable); | ||
} | ||
|
||
}} | ||
#endif // PRESSIOOPS_OPS_EPETRA_OPS_CLONE_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// ops_deep_copy.hpp | ||
// Pressio | ||
// Copyright 2019 | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, the | ||
// U.S. Government retains certain rights in this software. | ||
// | ||
// Pressio is licensed under BSD-3-Clause terms of use: | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived | ||
// from this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Francesco Rizzi ([email protected]) | ||
// | ||
// ************************************************************************ | ||
//@HEADER | ||
*/ | ||
|
||
#ifndef PRESSIOOPS_OPS_EPETRA_OPS_DEEP_COPY_HPP_ | ||
#define PRESSIOOPS_OPS_EPETRA_OPS_DEEP_COPY_HPP_ | ||
|
||
namespace pressio{ namespace ops{ | ||
|
||
template<typename T> | ||
std::enable_if_t< | ||
// TPL/container specific | ||
::pressio::is_vector_epetra<T>::value or | ||
::pressio::is_multi_vector_epetra<T>::value | ||
> | ||
deep_copy(T & dest, const T & src){ | ||
assert((matching_extents<T, T>::compare(dest, src))); | ||
dest = src; | ||
} | ||
|
||
}}//end namespace pressio::ops | ||
#endif // PRESSIOOPS_OPS_EPETRA_OPS_DEEP_COPY_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// ops_dot.hpp | ||
// Pressio | ||
// Copyright 2019 | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, the | ||
// U.S. Government retains certain rights in this software. | ||
// | ||
// Pressio is licensed under BSD-3-Clause terms of use: | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived | ||
// from this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Francesco Rizzi ([email protected]) | ||
// | ||
// ************************************************************************ | ||
//@HEADER | ||
*/ | ||
|
||
#ifndef PRESSIOOPS_OPS_EPETRA_OPS_DOT_HPP_ | ||
#define PRESSIOOPS_OPS_EPETRA_OPS_DOT_HPP_ | ||
|
||
namespace pressio{ namespace ops{ | ||
|
||
template <typename T1, typename T2, typename DotResult> | ||
std::enable_if_t< | ||
// TPL/container specific | ||
::pressio::is_vector_epetra<T1>::value | ||
&& ::pressio::is_vector_epetra<T2>::value | ||
// scalar compatibility | ||
&& ::pressio::all_have_traits_and_same_scalar<T1, T2>::value | ||
&& (std::is_floating_point<typename ::pressio::Traits<T1>::scalar_type>::value | ||
|| std::is_integral<typename ::pressio::Traits<T1>::scalar_type>::value) | ||
&& std::is_convertible< | ||
typename ::pressio::Traits<T1>::scalar_type, | ||
DotResult>::value | ||
> | ||
dot(const T1 & a, | ||
const T2 & b, | ||
DotResult & result) | ||
{ | ||
assert(a.MyLength() == b.MyLength()); | ||
using sc_t = typename ::pressio::Traits<T1>::scalar_type; | ||
sc_t ret; | ||
a.Dot(b, &ret); | ||
result = static_cast<DotResult>(ret); | ||
} | ||
|
||
template <typename T1, typename T2> | ||
std::enable_if_t< | ||
// TPL/container specific | ||
::pressio::is_vector_epetra<T1>::value | ||
&& ::pressio::is_vector_epetra<T2>::value | ||
// scalar compatibility | ||
&& ::pressio::all_have_traits_and_same_scalar<T1, T2>::value | ||
&& (std::is_floating_point<typename ::pressio::Traits<T1>::scalar_type>::value | ||
|| std::is_integral<typename ::pressio::Traits<T1>::scalar_type>::value), | ||
typename ::pressio::Traits<T1>::scalar_type | ||
> | ||
dot(const T1 & a, const T2 & b) | ||
{ | ||
using sc_t = typename ::pressio::Traits<T1>::scalar_type; | ||
sc_t result = {}; | ||
dot(a, b, result); | ||
return result; | ||
} | ||
|
||
}}//end namespace pressio::ops | ||
#endif // PRESSIOOPS_OPS_EPETRA_OPS_DOT_HPP_ |
Oops, something went wrong.