50 #ifdef HAVE_ZOLTAN2_PARMA 60 #include "Teuchos_XMLParameterListHelpers.hpp" 69 typedef Tpetra::DefaultPlatform::DefaultPlatformType
Platform;
70 typedef Tpetra::MultiVector<double, int, int>
tMVector_t;
74 if (ttype==apf::Mesh::VERTEX)
76 else if (ttype==apf::Mesh::EDGE)
80 else if (ttype==apf::Mesh::QUAD)
82 else if (ttype==apf::Mesh::TET)
84 else if (ttype==apf::Mesh::HEX)
91 throw "No such APF topology type";
99 int main(
int narg,
char *arg[]) {
101 Teuchos::GlobalMPISession mpiSession(&narg, &arg,0);
102 Platform &platform = Tpetra::DefaultPlatform::getDefaultPlatform();
103 RCP<const Teuchos::Comm<int> > CommT = platform.getComm();
105 #ifdef HAVE_ZOLTAN2_PARMA 111 apf::Mesh2* m = apf::loadMdsMesh(
"pumiTri14/plate.dmg",
"pumiTri14/2/");
114 int dim = m->getDimension();
118 typedef Adapter::lno_t lno_t;
119 typedef Adapter::gno_t gno_t;
120 typedef Adapter::scalar_t scalar_t;
122 std::string pri =
"face";
123 std::string adj =
"vertex";
137 bool* has =
new bool[dim+1];
138 for (
int i=0;i<=dim;i++) {
146 std::cerr<<
"Local number of entities does not match in dimension "<<i<<
"\n";
154 apf::GlobalNumbering** gnums =
new apf::GlobalNumbering*[dim];
155 apf::Numbering** lnums =
new apf::Numbering*[dim];
157 for (
int i=0;i<=dim;i++) {
162 gnums[i] = m->getGlobalNumbering(i-sub);
163 lnums[i] = m->getNumbering(i-sub);
166 for (
int i=0;i<=dim;i++) {
171 const scalar_t* x_coords;
172 const scalar_t* y_coords;
173 const scalar_t* z_coords;
177 const lno_t** offsets =
new const lno_t*[dim];
178 const gno_t** adj_gids =
new const gno_t*[dim];
186 for (
int j=0;j<=dim;j++) {
189 if (ia.
availAdjs(ents[i],ents[j])!=(i!=j)) {
190 std::cerr<<
"First Adjacency does not exist from "<<i<<
" to "<< j<<
"\n";
193 ia.
getAdjsView(ents[i],ents[j],offsets[j],adj_gids[j]);
196 apf::MeshIterator* itr = m->begin(i);
197 apf::MeshEntity* ent;
198 size_t* numAdjs =
new size_t[dim+1];
199 for (
int k=0;k<=dim;k++)
201 while ((ent=m->iterate(itr))) {
203 if (apf::getNumber(lnums[i],ent,0,0)!=j) {
204 std::cerr<<
"Local numbering does not match in dimension "<<i<<
" on entity "<<j<<
"\n";
208 if (apf::getNumber(gnums[i],
apf::Node(ent,0))!=gids[j]) {
209 std::cerr<<
"Global numbering does not match in dimension "<<i<<
" on entity "<<j<<
"\n";
215 std::cerr<<
"Topology types do not match in dimension "<<i<<
" on entity "<<j<<
"\n";
222 m->getPoint(ent,0,pnt);
224 pnt = apf::getLinearCentroid(m,ent);
226 if (fabs(pnt[0] - x_coords[j*x_stride])>eps) {
227 std::cerr<<
"X coordinate do not match in dimension "<<i<<
" on entity "<<j<<
"\n";
230 if (fabs(pnt[1] - y_coords[j*y_stride])>eps) {
231 std::cerr<<
"Y coordinate do not match in dimension "<<i<<
" on entity "<<j<<
"\n";
234 if (fabs(pnt[2] - z_coords[j*z_stride])>eps) {
235 std::cerr<<
"Z coordinate do not match in dimension "<<i<<
" on entity "<<j<<
"\n";
240 for (
int k=0;k<=dim;k++) {
245 if (offsets[k]!=NULL || adj_gids[k]!=NULL) {
246 std::cerr<<
"[WARNING] First adjacency to self is not set to NULL in dimension "<<i
247 <<
" to dimension "<<k<<
"\n";
253 m->getAdjacent(ent,k,adjs);
254 lno_t ind = offsets[k][j];
255 for (
unsigned int l=0;l<adjs.getSize();l++) {
256 if (apf::getNumber(gnums[k],
apf::Node(adjs[l],0))!=adj_gids[k][ind]) {
257 std::cerr<<
"First adjacency does not match in dimension " <<i<<
" to dimension "<<k
258 <<
" on entity "<<j<<
"\n";
263 if (ind!=offsets[k][j+1]) {
264 std::cerr<<
"First adjacency length does not match in dimension "<<i<<
" to dimension " 265 <<k<<
" on entity "<<j<<
"\n";
268 numAdjs[k]+=adjs.getSize();
277 for (
int k=0;k<=dim;k++) {
281 std::cerr<<
"Local number of first adjacencies do not match in dimension "<<i
282 <<
" through dimension "<<k<<
"\n";
291 const Adapter::scalar_t arr[] = {1,2,1,3,1,5,1,2,1,6,1,7,1,8};
295 std::cerr<<
"Number of weights incorrect\n";
301 const Adapter::scalar_t* arr2;
304 for (
int i=0;i<7;i++) {
305 if (arr[i*stride]!=arr2[i*stride]) {
306 std::cerr<<
"Weights do not match the original input\n";
311 bool ifIdontfeellikeit =
false;
312 apf::MeshTag*
weights = m->createDoubleTag(
"weights",2);
313 apf::MeshIterator* itr = m->begin(0);
314 apf::MeshEntity* ent;
315 while ((ent=m->iterate(itr))) {
316 if (!ifIdontfeellikeit||PCU_Comm_Self()) {
317 double w[]={1.0,PCU_Comm_Self()+1.0};
318 m->setDoubleTag(ent,
weights,w);
320 ifIdontfeellikeit=!ifIdontfeellikeit;
328 std::cerr<<
"Number of weights incorrect\n";
338 while ((ent=m->iterate(itr))) {
340 if (w!=arr2[i*stride]) {
341 std::cerr<<
"Weights do not match the original input\n";
353 while ((ent=m->iterate(itr))) {
356 m->getDoubleTag(ent,
weights,w);
359 if (w[1]!=arr2[i*stride]) {
360 std::cerr<<
"Weights do not match the original input\n";
virtual int getNumWeightsPerOf(MeshEntityType etype) const
Return the number of weights per entity.
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
virtual void getTopologyViewOf(MeshEntityType etype, enum EntityTopologyType const *&Types) const
Provide a pointer to the entity topology types.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
Defines the APFMeshAdapter class.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const lno_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process' mesh first adjacencies.
EntityTopologyType
Enumerate entity topology types for meshes: points,lines,polygons,triangles,quadrilaterals, polyhedrons, tetrahedrons, hexhedrons, prisms, or pyramids.
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.
virtual void getCoordinatesViewOf(MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
Provide a pointer to one dimension of entity coordinates.
virtual void getWeightsViewOf(MeshEntityType etype, const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to one of the number of this process' optional entity weights.