Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • openfpm_data openfpm_data
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Sbalzarini Lab
    • SSoftware
    • PParallel Computing
  • OpenFPM
  • openfpm_dataopenfpm_data
  • Wiki
  • Basic objects

Last edited by rundeck Oct 06, 2015
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Basic objects

Basic objects

The definition of a vector, grid, or graph, define how your data is organized, but does not define what is storing. For example a vector can store float, double, long int, or even more complex objects, same for grid, each point in the grid can store generic objects, same for Graph each vertex and edge can store generic objects. Generic object has two formats, here an example


/////////////////////////////////////
//    C++ FORMAT
/////////////////////////////////////
template<typename T> class Point_orig
{
public:

  T x;
  T y;
  T z;

  T s;

  T v[3];
  T t[3][3];

  // setter method

  inline void setx(T x_)	{x = x_;};
  inline void sety(T y_)	{y = y_;};
  inline void setz(T z_)	{z = z_;};
  inline void sets(T s_)	{s = s_;};
};


////////////////////////////////////
//  OPENFPM DATA STRUCTURE FORMAT
////////////////////////////////////
template<typename T> class Point_test
{
public:
  
  typedef boost::fusion::vector<T,T,T,T,T[3],T[3][3]> type;
  typedef typename memory_traits_inte<type>::type memory_int;
  typedef typename memory_traits_lin<type>::type memory_lin;

  type data;
  
  static const unsigned int x = 0;
  static const unsigned int y = 1;
  static const unsigned int z = 2;
  static const unsigned int s = 3;
  static const unsigned int v = 4;
  static const unsigned int t = 5;
  static const unsigned int max_prop = 6;

  // Setter method

  inline void setx(T x_)	{boost::fusion::at_c<0>(data) = x_;};
  inline void sety(T y_)	{boost::fusion::at_c<1>(data) = y_;};
  inline void setz(T z_)	{boost::fusion::at_c<2>(data) = z_;};
  inline void sets(T s_)	{boost::fusion::at_c<3>(data) = s_;};
};

The two definitions are equivalent, but the second one give the possibility to analyse/parse the members of the basic data. This can be useful in several situation, when the memory representation (Mappings) depend from the basic object, or for IO to produce output that require to go through each element of the structure to produce a nice output, or VCluster to check that the data structure you are sending contain no pointers. In any case all the structures implemented in OpenFPM_data must work at least with the OpenFPM data structure format. In case you are going to implementing a new structure inside OpenFPM_data, consider to use already implemented structure like vector or grid that already implements the capabilities that we are going to present in the following sections.

Clone repository
  • Basic objects
  • Home
  • Iterators
  • Memory mappings
  • Memory objects
  • Template order