51 #ifndef _ZOLTAN2_VECTORADAPTER_HPP_
52 #define _ZOLTAN2_VECTORADAPTER_HPP_
97 template <
typename User>
101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
109 typedef User userCoord_t;
142 int idx = 0)
const = 0;
153 const char *fileprefix,
154 const Teuchos::Comm<int> &comm
161 this->generateCoordsFileOnly(fileprefix, comm);
179 void generateCoordsFileOnly(
180 const char* fileprefix,
181 const Teuchos::Comm<int> &comm)
const;
185 template <
typename User>
186 void VectorAdapter<User>::generateCoordsFileOnly(
187 const char *fileprefix,
188 const Teuchos::Comm<int> &comm
194 int np = comm.getSize();
195 int me = comm.getRank();
199 std::string filenamestr = fileprefix;
200 filenamestr = filenamestr +
".coords";
201 const char *filename = filenamestr.c_str();
203 for (
int p = 0; p < np; p++) {
211 fp.open(filename, std::ios::out);
215 fp.open(filename, std::ios::app);
219 size_t len = this->getLocalNumIDs();
220 int nvec = this->getNumEntriesPerID();
221 const scalar_t **values =
new const scalar_t *[nvec];
222 int *strides =
new int[nvec];
223 for (
int n = 0; n < nvec; n++)
224 getEntriesView(values[n], strides[n], n);
228 for (
size_t i = 0; i < len; i++) {
229 for (
int n = 0; n < nvec; n++)
230 fp << values[n][i*strides[n]] <<
" ";
InputTraits< User >::scalar_t scalar_t
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
InputTraits< User >::gno_t gno_t
virtual int getNumEntriesPerID() const =0
Return the number of vectors.
void generateFiles(const char *fileprefix, const Teuchos::Comm< int > &comm) const
Write files that can be used as input to Zoltan or Zoltan2 driver Creates chaco-formatted input files...
InputTraits< User >::lno_t lno_t
void generateWeightFileOnly(const char *fileprefix, const Teuchos::Comm< int > &comm) const
BaseAdapterType
An enum to identify general types of adapters.
VectorAdapter defines the interface for vector input.
InputTraits< User >::part_t part_t
void getCoordinatesView(const scalar_t *&elements, int &stride, int idx=0) const
virtual ~VectorAdapter()
Destructor.
enum BaseAdapterType adapterType() const
Returns the type of adapter.
InputTraits< User >::offset_t offset_t
virtual void getEntriesView(const scalar_t *&elements, int &stride, int idx=0) const =0
Provide a pointer to the elements of the specified vector.
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t