50 #ifndef _ZOLTAN2_MODEL_HPP_
51 #define _ZOLTAN2_MODEL_HPP_
106 template <
typename Adapter>
111 #ifndef DOXYGEN_SHOULD_SKIP_THIS
114 typedef typename Adapter::gid_t gid_t;
126 Model() : idMap_(), weightDim_(0), uniform_() {}
194 const Teuchos::Comm<int> &comm)
196 weightDim_ = len.size();
201 int *lval =
new int [weightDim_];
202 uniform_ = arcp(lval, 0, weightDim_);
209 for (
int i=0; i < weightDim_; i++){
216 int *rval =
new int [weightDim_];
219 reduceAll<int, int>(comm, Teuchos::REDUCE_MAX, weightDim_, lval, rval);
223 for (
int i=0; i < weightDim_; i++){
240 template <
typename T>
241 static void maxCount(
const Comm<int> &comm, Array<T> &countValues)
243 size_t len = countValues.size();
244 if (comm.getSize() < 2 || len < 1)
246 Array<T> globalValues(len);
247 Teuchos::reduceAll<int, T>(comm, Teuchos::REDUCE_MAX, len,
248 countValues.getRawPtr(), globalValues.getRawPtr());
250 countValues = globalValues;
260 template <
typename T>
261 static void maxCount(
const Comm<int> &comm, T &value1)
263 Array<T> values(1, value1);
264 maxCount<T>(comm, values);
275 template <
typename T>
276 static void maxCount(
const Comm<int> &comm, T &value1, T &value2)
281 maxCount<T>(comm, values);
288 RCP<const idmap_t> idMap_;
291 ArrayRCP<int> uniform_;
use columns as graph vertices
An IdentifierMap manages a global space of object identifiers.
ModelFlags
Flags are set by a Problem to tell a Model what transformations it may need to do on the user's input...
Defines the IdentifierMap class.
use mesh nodes as vertices
ModelType
An identifier for the general type of model.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
static void maxCount(const Comm< int > &comm, Array< T > &countValues)
Get the global maximum for each of an array of values.
std::bitset< NUM_MODEL_FLAGS > modelFlag_t
algorithm requires consecutive ids
model must symmetrize input
static void maxCount(const Comm< int > &comm, T &value1, T &value2)
Get the global maximums for each of two values.
model must symmetrize input
int getNumWeights() const
Return the number of weights supplied for each object. If the user supplied no weights, dimension one is returned, because one dimension of uniform weights is implied.
Zoltan2::BasicUserTypes< scalar_t, gno_t, lno_t, gno_t > user_t
virtual global_size_t getGlobalNumObjects() const =0
Return the global number of objects.
use matrix rows as graph vertices
use nonzeros as graph vertices
static void maxCount(const Comm< int > &comm, T &value1)
Get the global maximum for a value.
use mesh elements as vertices
virtual void getGlobalObjectIds(ArrayView< const gno_t > &gnos) const =0
Get a list of the global Ids for the local objects.
bool uniformWeight(int weightDim) const
Return whether the weights are uniform or not.
Gathering definitions used in software development.
virtual size_t getLocalNumObjects() const =0
Return the local number of objects.
The base class for all model classes.
algorithm requires no self edges
RCP< const idmap_t > getIdentifierMap() const
Return the map from user global identifiers to internal Zoltan2 global numbers.
void setWeightArrayLengths(const Array< lno_t > &len, const Teuchos::Comm< int > &comm)
Set the length of each weight array. The Model calls this in the constructor so we know which weights...
void setIdentifierMap(RCP< const idmap_t > &map)
Set the IdentifierMap used by the model.