Skip to content

Commit

Permalink
From 80aadc784e3f79b69c7aa6fa277a54c91f2556ca Mon Sep 17 00:00:00 200…
Browse files Browse the repository at this point in the history
…1 From: Tom Haber <tomh@lab.exascience.com> Date: Tue, 4 Dec 2012 14:27:49 +0100 Subject: [PATCH] particle positions split (double -> int+float)
  • Loading branch information
tvandera committed Sep 7, 2016
1 parent 09d5754 commit b2e3df3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
15 changes: 10 additions & 5 deletions include/shark/part.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
#include "vec.hpp"

namespace shark {

namespace ndim {

template<int ndim, typename T>
struct part_position {
int pos;
float off;
};

template<int ndim>
struct part {
vec<ndim,T> x;
vec<ndim,T> v;
T w;
vec<ndim,part_position> x;
vec<ndim,double> v;
double w;
};

}
Expand Down
6 changes: 3 additions & 3 deletions include/shark/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace shark {
typedef shark::ndim::coords_range<1> coords_range;
typedef shark::ndim::Domain<1> Domain;
typedef shark::ndim::vec<1,double> vecD;
typedef shark::ndim::part<1,double> partD;
typedef shark::ndim::part<1> partD;
typedef shark::ndim::GlobalArray<1,int> GlobalArrayI;
typedef shark::ndim::GlobalArray<1,long> GlobalArrayL;
typedef shark::ndim::GlobalArray<1,float> GlobalArrayF;
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace shark {
typedef shark::ndim::coords_range<2> coords_range;
typedef shark::ndim::Domain<2> Domain;
typedef shark::ndim::vec<2,double> vecD;
typedef shark::ndim::part<2,double> partD;
typedef shark::ndim::part<2> partD;
typedef shark::ndim::GlobalArray<2,int> GlobalArrayI;
typedef shark::ndim::GlobalArray<2,long> GlobalArrayL;
typedef shark::ndim::GlobalArray<2,float> GlobalArrayF;
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace shark {
typedef shark::ndim::coords_range<3> coords_range;
typedef shark::ndim::Domain<3> Domain;
typedef shark::ndim::vec<3,double> vecD;
typedef shark::ndim::part<3,double> partD;
typedef shark::ndim::part<3> partD;
typedef shark::ndim::GlobalArray<3,int> GlobalArrayI;
typedef shark::ndim::GlobalArray<3,long> GlobalArrayL;
typedef shark::ndim::GlobalArray<3,float> GlobalArrayF;
Expand Down
2 changes: 1 addition & 1 deletion inst_dimtype.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#ifndef SYMB_ARITH

#define SYMBD(d) SYMBDT(d,shark::ndim::part<d COMMA double>)
#define SYMBD(d) SYMBDT(d,shark::ndim::part<d>)
#include "inst_dim"
#undef SYMBD

Expand Down
3 changes: 2 additions & 1 deletion src/comm_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using namespace shark::ndim;

#if defined(SHARK_MPI_COMM)

template<> const MPI_Datatype mpi_type<char>::t = MPI_CHAR;
template<> const MPI_Datatype mpi_type<int>::t = MPI_INT;
template<> const MPI_Datatype mpi_type<long>::t = MPI_LONG;
template<> const MPI_Datatype mpi_type<float>::t = MPI_FLOAT;
Expand All @@ -23,7 +24,7 @@ template<> const MPI_Datatype mpi_type<std::complex<long double>>::t = MPI_C_LON
template<int ndim> const MPI_Datatype mpi_type<coords_range<ndim>>::t = mpi_type<coord>::t;

template<int ndim,typename T> const MPI_Datatype mpi_type<vec<ndim,T>>::t = mpi_type<T>::t;
template<int ndim,typename T> const MPI_Datatype mpi_type<part<ndim,T>>::t = mpi_type<T>::t;
template<int ndim> const MPI_Datatype mpi_type<part<ndim>>::t = mpi_type<char>::t;

template<typename T> const MPI_Datatype mpi_type<valarray<T>>::t = mpi_type<T>::t;

Expand Down
10 changes: 5 additions & 5 deletions src/comm_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ namespace shark {
/*
* mpi_type for part
*/
template<int ndim,typename T>
struct mpi_type<shark::ndim::part<ndim,T>> {
template<int ndim>
struct mpi_type<shark::ndim::part<ndim>> {
static const MPI_Datatype t;
INLINE static int count();
};

template<int ndim,typename T>
inline int mpi_type<shark::ndim::part<ndim,T>>::count() {
return ndim*2 + 1;
template<int ndim>
inline int mpi_type<shark::ndim::part<ndim>>::count() {
return sizeof(shark::ndim::part<ndim>);
}

/*
Expand Down
10 changes: 2 additions & 8 deletions src/comm_other_inst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

#if defined(SHARK_MPI_COMM)

#define SYMBD(d) SYMBT(shark::ndim::part<d COMMA float>)
#include "inst_dim"
#undef SYMBD
#define SYMBD(d) SYMBT(shark::ndim::part<d COMMA double>)
#define SYMBD(d) SYMBT(shark::ndim::part<d>)
#include "inst_dim"
#undef SYMBD
#define SYMBD(d) SYMBT(shark::ndim::coords_range<d>)
Expand All @@ -17,10 +14,7 @@

#elif defined(SHARK_NO_COMM)

#define SYMBD(d) SYMBT(shark::ndim::part<d COMMA float>)
#include "inst_dim"
#undef SYMBD
#define SYMBD(d) SYMBT(shark::ndim::part<d COMMA double>)
#define SYMBD(d) SYMBT(shark::ndim::part<d>)
#include "inst_dim"
#undef SYMBD
#define SYMBD(d) SYMBT(shark::ndim::coords_range<d>)
Expand Down

0 comments on commit b2e3df3

Please sign in to comment.