Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
ZoltanPartitioner.cpp File Reference
#include <iostream>
#include <cassert>
#include <sstream>
#include <algorithm>
#include "moab/ZoltanPartitioner.hpp"
#include "moab/Interface.hpp"
#include "Internals.hpp"
#include "moab/Range.hpp"
#include "moab/WriteUtilIface.hpp"
#include "moab/MeshTopoUtil.hpp"
#include "MBTagConventions.hpp"
#include "moab/CN.hpp"
#include "moab/IntxMesh/IntxUtils.hpp"
+ Include dependency graph for ZoltanPartitioner.cpp:

Go to the source code of this file.

Macros

#define RR    if( MB_SUCCESS != result ) return result
 

Functions

int mbGetNumberOfAssignedObjects (void *, int *err)
 
void mbGetObjectList (void *, int, int, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int wgt_dim, float *obj_wgts, int *err)
 
int mbGetObjectSize (void *, int *err)
 
void mbGetObject (void *, int, int, int numObjs, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int numDim, double *pts, int *err)
 
void mbGetNumberOfEdges (void *, int, int, int numObjs, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int *numEdges, int *err)
 
void mbGetEdgeList (void *, int, int, int numObjs, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int *, ZOLTAN_ID_PTR nborGlobalIds, int *nborProcs, int wgt_dim, float *edge_wgts, int *err)
 
void mbGetPart (void *, int, int, int numObjs, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int *part, int *err)
 

Variables

static double * Points = NULL
 
static int * GlobalIds = NULL
 
static int NumPoints = 0
 
static int * NumEdges = NULL
 
static int * NborGlobalId = NULL
 
static int * NborProcs = NULL
 
static double * ObjWeights = NULL
 
static double * EdgeWeights = NULL
 
static int * Parts = NULL
 
const bool debug = false
 

Macro Definition Documentation

◆ RR

#define RR    if( MB_SUCCESS != result ) return result

Definition at line 41 of file ZoltanPartitioner.cpp.

Function Documentation

◆ mbGetEdgeList()

void mbGetEdgeList ( void *  userDefinedData,
int  numGlobalIds,
int  numLids,
int  numObjs,
ZOLTAN_ID_PTR  gids,
ZOLTAN_ID_PTR  lids,
int *  numEdges,
ZOLTAN_ID_PTR  nborGlobalIds,
int *  nborProcs,
int  wgt_dim,
float *  edge_wgts,
int *  err 
)

Definition at line 1475 of file ZoltanPartitioner.cpp.

1487 {
1488  int i, id, idSum, j;
1489  int next = 0;
1490 
1491  for( i = 0; i < numObjs; i++ )
1492  {
1493  id = lids[i];
1494 
1495  if( ( id < 0 ) || ( id >= NumPoints ) )
1496  {
1497  *err = 1;
1498  return;
1499  }
1500 
1501  idSum = 0;
1502 
1503  for( j = 0; j < id; j++ )
1504  idSum += NumEdges[j];
1505 
1506  for( j = 0; j < NumEdges[id]; j++ )
1507  {
1508  nborGlobalIds[next] = NborGlobalId[idSum];
1509  nborProcs[next] = NborProcs[idSum];
1510  if( wgt_dim > 0 ) edge_wgts[next] = EdgeWeights[idSum];
1511  next++;
1512  idSum++;
1513  }
1514  }
1515 }

References EdgeWeights, NborGlobalId, NborProcs, NumEdges, and NumPoints.

Referenced by ZoltanPartitioner::balance_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), ZoltanPartitioner::repartition(), and ZoltanPartitioner::repartition_to_procs().

◆ mbGetNumberOfAssignedObjects()

int mbGetNumberOfAssignedObjects ( void *  userDefinedData,
int *  err 
)

MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.

Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Zoltan: class to get a mesh from MOAB and write a Zoltan partition set for that mesh back into MOAB and to a file

Definition at line 1381 of file ZoltanPartitioner.cpp.

1382 {
1383  *err = 0;
1384  return NumPoints;
1385 }

References NumPoints.

Referenced by ZoltanPartitioner::balance_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), ZoltanPartitioner::repartition(), and ZoltanPartitioner::repartition_to_procs().

◆ mbGetNumberOfEdges()

void mbGetNumberOfEdges ( void *  userDefinedData,
int  numGlobalIds,
int  numLids,
int  numObjs,
ZOLTAN_ID_PTR  gids,
ZOLTAN_ID_PTR  lids,
int *  numEdges,
int *  err 
)

Definition at line 1449 of file ZoltanPartitioner.cpp.

1457 {
1458  int i, id;
1459  int next = 0;
1460 
1461  for( i = 0; i < numObjs; i++ )
1462  {
1463  id = lids[i];
1464 
1465  if( ( id < 0 ) || ( id >= NumPoints ) )
1466  {
1467  *err = 1;
1468  return;
1469  }
1470 
1471  numEdges[next++] = NumEdges[id];
1472  }
1473 }

References NumEdges, and NumPoints.

Referenced by ZoltanPartitioner::balance_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), ZoltanPartitioner::repartition(), and ZoltanPartitioner::repartition_to_procs().

◆ mbGetObject()

void mbGetObject ( void *  userDefinedData,
int  numGlobalIds,
int  numLids,
int  numObjs,
ZOLTAN_ID_PTR  gids,
ZOLTAN_ID_PTR  lids,
int  numDim,
double *  pts,
int *  err 
)

Definition at line 1412 of file ZoltanPartitioner.cpp.

1421 {
1422  int i, id, id3;
1423  int next = 0;
1424 
1425  if( numDim != 3 )
1426  {
1427  *err = 1;
1428  return;
1429  }
1430 
1431  for( i = 0; i < numObjs; i++ )
1432  {
1433  id = lids[i];
1434 
1435  if( ( id < 0 ) || ( id >= NumPoints ) )
1436  {
1437  *err = 1;
1438  return;
1439  }
1440 
1441  id3 = lids[i] * 3;
1442 
1443  pts[next++] = Points[id3];
1444  pts[next++] = Points[id3 + 1];
1445  pts[next++] = Points[id3 + 2];
1446  }
1447 }

References NumPoints, and Points.

Referenced by ZoltanPartitioner::balance_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), ZoltanPartitioner::repartition(), and ZoltanPartitioner::repartition_to_procs().

◆ mbGetObjectList()

void mbGetObjectList ( void *  userDefinedData,
int  numGlobalIds,
int  numLids,
ZOLTAN_ID_PTR  gids,
ZOLTAN_ID_PTR  lids,
int  wgt_dim,
float *  obj_wgts,
int *  err 
)

Definition at line 1387 of file ZoltanPartitioner.cpp.

1395 {
1396  for( int i = 0; i < NumPoints; i++ )
1397  {
1398  gids[i] = GlobalIds[i];
1399  lids[i] = i;
1400  if( wgt_dim > 0 ) obj_wgts[i] = ObjWeights[i];
1401  }
1402 
1403  *err = 0;
1404 }

References GlobalIds, NumPoints, and ObjWeights.

Referenced by ZoltanPartitioner::balance_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), ZoltanPartitioner::repartition(), and ZoltanPartitioner::repartition_to_procs().

◆ mbGetObjectSize()

int mbGetObjectSize ( void *  userDefinedData,
int *  err 
)

◆ mbGetPart()

void mbGetPart ( void *  userDefinedData,
int  numGlobalIds,
int  numLids,
int  numObjs,
ZOLTAN_ID_PTR  gids,
ZOLTAN_ID_PTR  lids,
int *  part,
int *  err 
)

Definition at line 1517 of file ZoltanPartitioner.cpp.

1525 {
1526  int i, id;
1527  int next = 0;
1528 
1529  for( i = 0; i < numObjs; i++ )
1530  {
1531  id = lids[i];
1532 
1533  if( ( id < 0 ) || ( id >= NumPoints ) )
1534  {
1535  *err = 1;
1536  return;
1537  }
1538 
1539  part[next++] = Parts[id];
1540  }
1541 }

References NumPoints, and Parts.

Referenced by ZoltanPartitioner::partition_mesh_and_geometry().

Variable Documentation

◆ debug

const bool debug = false

Definition at line 54 of file ZoltanPartitioner.cpp.

Referenced by ZoltanPartitioner::assemble_graph().

◆ EdgeWeights

◆ GlobalIds

◆ NborGlobalId

◆ NborProcs

◆ NumEdges

◆ NumPoints

◆ ObjWeights

◆ Parts

◆ Points