SundanceSpatiallyHomogeneousDOFMapBase.cpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                             Sundance
00005 //                 Copyright 2011 Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu)
00038 // 
00039 
00040 /* @HEADER@ */
00041 
00042 #include "SundanceSpatiallyHomogeneousDOFMapBase.hpp"
00043 #include "PlayaTabs.hpp"
00044 #include "SundanceOut.hpp"
00045 #include "SundanceMaximalCellFilter.hpp"
00046 
00047 using namespace Sundance;
00048 using namespace Teuchos;
00049 
00050 
00051 SpatiallyHomogeneousDOFMapBase
00052 ::SpatiallyHomogeneousDOFMapBase(const Mesh& mesh,
00053   int nTotalFuncs,
00054   int setupVerb)
00055   : DOFMapBase(mesh, setupVerb), allowedFuncs_(), funcDomains_()
00056 {
00057   RCP<Set<int> > f = rcp(new Set<int>());
00058   for (int i=0; i<nTotalFuncs; i++) f->put(i);
00059   allowedFuncs_ = f;
00060   CellFilter cf = new MaximalCellFilter();
00061   funcDomains_ = Array<CellFilter>(nTotalFuncs, cf);
00062 }
00063 
00064 
00065 void SpatiallyHomogeneousDOFMapBase::print(std::ostream& os) const
00066 {
00067   int myRank = mesh().comm().getRank();
00068 
00069   Tabs tabs;
00070   int dim = mesh().spatialDim();
00071   RCP<const MapStructure> s = mapStruct();
00072 
00073   for (int p=0; p<mesh().comm().getNProc(); p++)
00074   {
00075     mesh().comm().synchronize();
00076     mesh().comm().synchronize();
00077     if (p == myRank)
00078     {
00079       os << tabs << 
00080         "========= DOFMap on proc p=" << p << " =============" << std::endl;
00081       for (int d=dim; d>=0; d--)
00082       {
00083         Tabs tabs1;
00084         os << tabs1 << "dimension = " << d << std::endl;
00085         for (int c=0; c<mesh().numCells(d); c++)
00086         {
00087           Tabs tabs2;
00088           os << tabs2 << "Cell d=" << d << " LID=" << c << " GID=" 
00089              << mesh().mapLIDToGID(d, c);
00090           if (d==0) 
00091           {
00092             os << " x=" << mesh().nodePosition(c) << std::endl;
00093           }
00094           else 
00095           {
00096             Array<int> facetLIDs;
00097             Array<int> facetDirs;
00098             mesh().getFacetArray(d, c, 0, facetLIDs, facetDirs);
00099             Array<int> facetGIDs(facetLIDs.size());
00100             for (int v=0; v<facetLIDs.size(); v++)
00101             {
00102               facetGIDs[v] = mesh().mapLIDToGID(0, facetLIDs[v]);
00103             }
00104             os << " nodes LIDs=" << facetLIDs << " GIDs=" << facetGIDs
00105                << std::endl;
00106           }
00107           for (int b=0; b<s->numBasisChunks(); b++)
00108           {
00109             for (int f=0; f<s->funcs(b).size(); f++)
00110             {
00111               Tabs tabs3;
00112               Array<int> dofs;
00113               getDOFsForCell(d, c, s->funcs(b)[f], dofs);
00114               os << tabs3 << "f=" << s->funcs(b)[f] << " " 
00115                  << dofs << std::endl;
00116               if (false)
00117               {
00118                 os << tabs3 << "{";
00119                 for (int i=0; i<dofs.size(); i++)
00120                 {
00121                   if (i != 0) os << ", ";
00122                   if (isLocalDOF(dofs[i])) os << "L";
00123                   else os << "R";
00124                 }
00125                 os << "}" << std::endl;
00126               }
00127             }
00128           }
00129         }
00130       }
00131     }
00132     mesh().comm().synchronize();
00133     mesh().comm().synchronize();
00134   }
00135 }

Site Contact