1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| class Vec
{};
typedef int PetscErrorCode;
typedef int PetscScalar;
typedef int MPI_Comm;
typedef int PetscInt;
namespace example
{
template< template<class> class Policy > class Vector;
template< template<class> class DistributionPolicy >
PetscErrorCode dot(Vector<DistributionPolicy> const & x , Vector<DistributionPolicy> const & y , PetscScalar * val);
template< template<class> class DistributionPolicy > class Vector : public DistributionPolicy<Vec>
{
friend PetscErrorCode dot<>(Vector<DistributionPolicy> const & x , Vector<DistributionPolicy> const & y , PetscScalar * val);
private:
Vec m_self;
};
template< template<class> class DistributionPolicy >
inline PetscErrorCode dot(Vector<DistributionPolicy> const & x,
Vector<DistributionPolicy> const & y,
PetscScalar* val) {
return 0;
}
template< class T > struct sequential;
template<> struct sequential<Vec> {
static PetscErrorCode create(MPI_Comm comm,PetscInt n,Vec *v) {
return 0;
}
};
}
int main() {
example::Vector<example::sequential> vec1;
example::Vector<example::sequential> vec2;
example::dot(vec1, vec2, 0);
return 0;
} |
Partager