SundanceSpatiallyHomogeneousDOFMapBase.cpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #include "SundanceSpatiallyHomogeneousDOFMapBase.hpp"
00032 #include "PlayaTabs.hpp"
00033 #include "SundanceOut.hpp"
00034 #include "SundanceMaximalCellFilter.hpp"
00035 
00036 using namespace Sundance;
00037 using namespace Teuchos;
00038 
00039 
00040 SpatiallyHomogeneousDOFMapBase
00041 ::SpatiallyHomogeneousDOFMapBase(const Mesh& mesh,
00042   int nTotalFuncs,
00043   int setupVerb)
00044   : DOFMapBase(mesh, setupVerb), allowedFuncs_(), funcDomains_()
00045 {
00046   RCP<Set<int> > f = rcp(new Set<int>());
00047   for (int i=0; i<nTotalFuncs; i++) f->put(i);
00048   allowedFuncs_ = f;
00049   CellFilter cf = new MaximalCellFilter();
00050   funcDomains_ = Array<CellFilter>(nTotalFuncs, cf);
00051 }
00052 
00053 
00054 void SpatiallyHomogeneousDOFMapBase::print(std::ostream& os) const
00055 {
00056   int myRank = mesh().comm().getRank();
00057 
00058   Tabs tabs;
00059   int dim = mesh().spatialDim();
00060   RCP<const MapStructure> s = mapStruct();
00061 
00062   for (int p=0; p<mesh().comm().getNProc(); p++)
00063   {
00064     mesh().comm().synchronize();
00065     mesh().comm().synchronize();
00066     if (p == myRank)
00067     {
00068       os << tabs << 
00069         "========= DOFMap on proc p=" << p << " =============" << std::endl;
00070       for (int d=dim; d>=0; d--)
00071       {
00072         Tabs tabs1;
00073         os << tabs1 << "dimension = " << d << std::endl;
00074         for (int c=0; c<mesh().numCells(d); c++)
00075         {
00076           Tabs tabs2;
00077           os << tabs2 << "Cell d=" << d << " LID=" << c << " GID=" 
00078              << mesh().mapLIDToGID(d, c);
00079           if (d==0) 
00080           {
00081             os << " x=" << mesh().nodePosition(c) << std::endl;
00082           }
00083           else 
00084           {
00085             Array<int> facetLIDs;
00086             Array<int> facetDirs;
00087             mesh().getFacetArray(d, c, 0, facetLIDs, facetDirs);
00088             Array<int> facetGIDs(facetLIDs.size());
00089             for (int v=0; v<facetLIDs.size(); v++)
00090             {
00091               facetGIDs[v] = mesh().mapLIDToGID(0, facetLIDs[v]);
00092             }
00093             os << " nodes LIDs=" << facetLIDs << " GIDs=" << facetGIDs
00094                << std::endl;
00095           }
00096           for (int b=0; b<s->numBasisChunks(); b++)
00097           {
00098             for (int f=0; f<s->funcs(b).size(); f++)
00099             {
00100               Tabs tabs3;
00101               Array<int> dofs;
00102               getDOFsForCell(d, c, s->funcs(b)[f], dofs);
00103               os << tabs3 << "f=" << s->funcs(b)[f] << " " 
00104                  << dofs << std::endl;
00105               if (false)
00106               {
00107                 os << tabs3 << "{";
00108                 for (int i=0; i<dofs.size(); i++)
00109                 {
00110                   if (i != 0) os << ", ";
00111                   if (isLocalDOF(dofs[i])) os << "L";
00112                   else os << "R";
00113                 }
00114                 os << "}" << std::endl;
00115               }
00116             }
00117           }
00118         }
00119       }
00120     }
00121     mesh().comm().synchronize();
00122     mesh().comm().synchronize();
00123   }
00124 }

Site Contact