Commit baafab1d authored by Jonathan Jenkins's avatar Jonathan Jenkins

expose the torus ID mapping functions to modelnet

parent a57bc2d2
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* annotation), while ignore_annotations is a flag controlling whether * annotation), while ignore_annotations is a flag controlling whether
* annotations are checked for or not - if not, then */ * annotations are checked for or not - if not, then */
/** TORUS FUNCTIONS **/
/* get the dimensions of a torus configuration torus network. n and dims are /* get the dimensions of a torus configuration torus network. n and dims are
* return paramters */ * return paramters */
void model_net_torus_get_dims( void model_net_torus_get_dims(
...@@ -23,6 +25,17 @@ void model_net_torus_get_dims( ...@@ -23,6 +25,17 @@ void model_net_torus_get_dims(
int * n, int * n,
int const * const * dims); int const * const * dims);
/* mapping utilities to and from linearized torus node ids */
void model_net_torus_get_dim_id(
int flat_id,
int ndims,
const int * dim_lens,
int * out_dim_ids);
int model_net_torus_get_flat_id(
int ndims,
const int * dim_lens,
const int * dim_ids);
#endif /* end of include guard: MODEL_NET_INSPECT_H */ #endif /* end of include guard: MODEL_NET_INSPECT_H */
......
...@@ -1404,6 +1404,24 @@ void model_net_torus_get_dims( ...@@ -1404,6 +1404,24 @@ void model_net_torus_get_dims(
*dims = p->dim_length; *dims = p->dim_length;
} }
void model_net_torus_get_dim_id(
int flat_id,
int ndims,
const int * dim_lens,
int * out_dim_ids)
{
to_dim_id(flat_id, ndims, dim_lens, out_dim_ids);
}
int model_net_torus_get_flat_id(
int ndims,
const int * dim_lens,
const int * dim_ids)
{
return to_flat_id(ndims, dim_lens, dim_ids);
}
/* /*
* Local variables: * Local variables:
* c-indent-level: 4 * c-indent-level: 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment