Zoltan2 Version of the Day
Zoltan2_MeshInput.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //   Zoltan2: A package of combinatorial algorithms for scientific computing
00006 //                  Copyright 2012 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Vitus Leung (vjleung@sandia.gov)
00039 //
00040 // ***********************************************************************
00041 //
00042 // @HEADER
00043 
00049 #ifndef _ZOLTAN2_MESHINPUT_HPP_
00050 #define _ZOLTAN2_MESHINPUT_HPP_
00051 
00052 #include <Zoltan2_InputAdapter.hpp>
00053 #include <Zoltan2_PartitioningSolution.hpp>
00054 
00055 #include <string>
00056 
00057 namespace Zoltan2 {
00058 
00095 template <typename User>
00096   class MeshInput : public InputAdapter {
00097 private:
00098 
00099 public:
00100 
00101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00102   typedef typename InputTraits<User>::scalar_t    scalar_t;
00103   typedef typename InputTraits<User>::lno_t    lno_t;
00104   typedef typename InputTraits<User>::gno_t    gno_t;
00105   typedef typename InputTraits<User>::gid_t    gid_t;
00106   typedef typename InputTraits<User>::node_t   node_t;
00107   typedef User user_t;
00108 #endif
00109 
00110   enum InputAdapterType inputAdapterType() const {return MeshAdapterType;}
00111 
00114   virtual ~MeshInput() {};
00115 
00116   enum entityType = {REGION, FACE, EDGE, VERTEX};
00117 
00120   virtual size_t getGlobalNumEntityIDs(entityType etype) const = 0;
00121 
00122 
00125   virtual size_t getLocalNumEntityIDs(entityType etype) const = 0;
00126 
00127 
00133   virtual int getNumWeightsPerEntityID(entityType etype) const = 0;
00134 
00135 
00144   virtual size_t getLocalEntityIDsView(entityType etype,
00145                gid_t const *&Ids) const = 0;
00146 
00147 
00170   virtual size_t getLocalEntityIDsWeightsView(entityType etype,
00171      const scalar_t *&weights, int &stride, int number) const = 0;
00172 
00173 
00184   virtual size_t getEntityIDWeights(gid_t id, scalar_t *wgts) const = 0;
00185 
00186 
00195   virtual int getEntityCoordinateDimension(entityType etype) const = 0;
00196 
00214   virtual size_t getLocalEntityCoordinatesView(entityType etype,
00215     const scalar_t *&coords, int &stride, int coordDim) const = 0;
00216 
00217 
00227   virtual size_t getEntityCoordinates(gid_t id, scalar_t *coords) const = 0;
00228 
00229 
00232   virtual bool availAdjs(entityType source, entityType target);
00233 
00234 
00237   virtual size_t getLocalNumAdjs(entityType source,
00238            entityType target) const = 0;
00239 
00240 
00244   virtual size_t getEntityNumAdjs(entityType source, entityType target,
00245           gid_t id) const = 0;
00246 
00247 
00263   virtual size_t getLocalAdjsView(entityType source, entityType target,
00264      const lno_t *&offsets, const gid_t *& adjacencyIds) const = 0;
00265 
00266 
00274   virtual size_t getEntityAdjs(entityType source, entityType target,
00275              gid_t id, gid_t *adjacencyIds) const = 0;
00276 
00277 
00280   virtual bool avail2ndAdjs(entityType sourcetarget, entityType through);
00281 
00282 
00287   virtual size_t getGlobalNum2ndAdjs(entityType sourcetarget,
00288                entityType through) const = 0;
00289 
00290 
00298   virtual size_t getLocalNum2ndAdjs(entityType sourcetarget,
00299               entityType through) const = 0;
00300 
00301 
00307   virtual lno_t getEntityNum2ndAdjs(entityType sourcetarget,
00308      entityType through, gid_t id) const = 0;
00309 
00310 
00326 // TODO:  Later may allow user to not implement second adjacencies and, if we want them,
00327 // TODO:  we compute A^T A, where A is matrix of first adjacencies.
00328   virtual size_t getLocal2ndAdjsView(entityType sourcetarget,
00329      entityType through, const lno_t *&offsets,
00330      const gid_t *& adjacencyIds) const = 0;
00331 
00332 
00340   virtual size_t getEntity2ndAdjs(entityType sourcetarget,
00341      entityType through, gid_t id, gid_t *nborIds) const = 0;
00342 
00343 
00346   virtual int getNumWeightsPer2ndAdj(entityType sourcetarger,
00347                entityType through) const = 0;
00348 
00349 
00363   virtual size_t getLocal2ndAdjWeightsView(entityType sourcetarget,
00364      entityType through, const scalar_t *&weights, int &stride,
00365      int number) const = 0;
00366 
00367 
00375   virtual size_t getEntity2ndAdjWeights(entityType sourcetarget,
00376      entityType through, gid_t id, scalar_t *ewgts);
00377 
00378 
00397   template <typename Adapter>
00398     size_t applyPartitioningSolution(const User &in, User *&out,
00399          const PartitioningSolution<Adapter> &solution) const
00400   {
00401     return 0;
00402   }
00403   
00404 };
00405   
00406 }  //namespace Zoltan2
00407   
00408 #endif