/usr/include/trilinos/zoltan_comm_cpp.h is in libtrilinos-zoltan-dev 12.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | /*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
//
// ************************************************************************
//
// C++ wrappers for Zoltan communication library.
//
// Two styles of initialization:
//
// C++ style: Zoltan_Comm comm(nvals, assign, comm, tag, pnvals_recv);
//
// C style: Zoltan_Comm comm;
// comm.Create(nvals, assign, comm, tag, pnvals_recv);
//
// ************************************************************************
#ifndef ZOLTAN_COMM_CPP_H_
#define ZOLTAN_COMM_CPP_H_
#include "zoltan_comm.h"
class Zoltan_Comm {
public:
Zoltan_Comm(const int &nvals, int *assign, const MPI_Comm &comm,
const int &tag, int *pnvals_recv)
{
// Assumption: MPI has been initialized prior to this call.
Zoltan_Comm_Create(&this->Plan, nvals, assign, comm, tag, pnvals_recv);
}
Zoltan_Comm()
{
this->Plan = NULL;
// Caller will have to call Create to finish initialization of object
}
int Create(const int &nvals, int *assign, const MPI_Comm &comm,
const int &tag, int *pnvals_recv)
{
if (this->Plan)
{
Zoltan_Comm_Destroy(&this->Plan);
this->Plan = NULL;
}
int rc = Zoltan_Comm_Create(&this->Plan, nvals, assign, comm, tag, pnvals_recv);
return rc;
}
Zoltan_Comm (const Zoltan_Comm &plan) // Copy constructor
{
this->Plan = Zoltan_Comm_Copy(plan.Plan);
}
~Zoltan_Comm()
{
Zoltan_Comm_Destroy(&this->Plan);
}
Zoltan_Comm & operator= (const Zoltan_Comm &plan) // Copy operator
{
Zoltan_Comm_Copy_To(&this->Plan, plan.Plan);
return *this;
}
int Resize(int *sizes, const int &tag, int *sum_recv_sizes)
{
return Zoltan_Comm_Resize( this->Plan, sizes, tag, sum_recv_sizes);
}
int Do(const int &tag, char *send_data, const int &nbytes, char *recv_data)
{
return Zoltan_Comm_Do(this->Plan, tag, send_data, nbytes, recv_data);
}
int Do_Post( const int &tag, char *send_data, const int &nbytes, char *recv_data)
{
return Zoltan_Comm_Do_Post(this->Plan, tag, send_data, nbytes, recv_data);
}
int Do_Wait(const int &tag, char *send_data, const int &nbytes, char *recv_data)
{
return Zoltan_Comm_Do_Wait(this->Plan, tag, send_data, nbytes, recv_data);
}
int Do_Reverse(const int &tag, char *send_data, const int &nbytes, int *sizes, char *recv_data)
{
return Zoltan_Comm_Do_Reverse(this->Plan, tag, send_data, nbytes, sizes,
recv_data);
}
int Do_Reverse_Post(const int &tag, char *send_data, const int &nbytes, int *sizes,
char *recv_data)
{
return Zoltan_Comm_Do_Reverse_Post(this->Plan, tag, send_data, nbytes, sizes,
recv_data);
}
int Do_Reverse_Wait(const int &tag, char *send_data, const int &nbytes, int *sizes,
char *recv_data)
{
return Zoltan_Comm_Do_Reverse_Wait(this->Plan, tag, send_data, nbytes, sizes,
recv_data);
}
int Info( int *nsends, int *send_procs,
int *send_lengths, int *send_nvals, int *send_max_size, int *send_list,
int *nrecvs, int *recv_procs, int *recv_lengths, int *recv_nvals,
int *recv_total_size, int *recv_list, int *self_msg) const
{
return Zoltan_Comm_Info( this->Plan, nsends, send_procs, send_lengths,
send_nvals, send_max_size, send_list, nrecvs, recv_procs, recv_lengths,
recv_nvals, recv_total_size, recv_list, self_msg);
}
int Invert_Plan()
{
return Zoltan_Comm_Invert_Plan(&this->Plan);
}
// Static methods
static int Invert_Map( int *lengths_to, int *procs_to,
const int &nsends, const int &self_msg,
int * &plengths_from, int * &pprocs_from, int &pnrecvs,
const int &my_proc, const int &nprocs, const int &out_of_mem,
const int &tag, const MPI_Comm &comm)
{
return Zoltan_Comm_Invert_Map( lengths_to, procs_to, nsends, self_msg,
&plengths_from, &pprocs_from, &pnrecvs, my_proc, nprocs, out_of_mem,
tag, comm);
}
static int Exchange_Sizes( int *sizes_to, int *procs_to,
const int &nsends, const int &self_msg,
int *sizes_from, int *procs_from, const int &nrecvs, int *total_recv_size,
const int &my_proc, const int &tag, const MPI_Comm &comm)
{
return Zoltan_Comm_Exchange_Sizes(sizes_to, procs_to, nsends, self_msg,
sizes_from, procs_from, nrecvs, total_recv_size, my_proc, tag,
comm);
}
private:
ZOLTAN_COMM_OBJ *Plan;
};
#endif
|