MFEM v2.0
pfespace.hpp
Go to the documentation of this file.
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
00003 // reserved. See file COPYRIGHT for details.
00004 //
00005 // This file is part of the MFEM library. For more information and source code
00006 // availability see http://mfem.googlecode.com.
00007 //
00008 // MFEM is free software; you can redistribute it and/or modify it under the
00009 // terms of the GNU Lesser General Public License (as published by the Free
00010 // Software Foundation) version 2.1 dated February 1999.
00011 
00012 #ifndef MFEM_PFESPACE
00013 #define MFEM_PFESPACE
00014 
00016 class ParFiniteElementSpace : public FiniteElementSpace
00017 {
00018 private:
00020    MPI_Comm MyComm;
00021    int NRanks, MyRank;
00022 
00024    ParMesh *pmesh;
00025 
00027    GroupCommunicator *gcomm;
00028 
00030    int ltdof_size;
00031 
00033    Array<int> ldof_group;
00034 
00036    Array<int> ldof_ltdof;
00037 
00039    Array<int> dof_offsets;
00040 
00042    Array<int> tdof_offsets;
00043 
00045    Array<int> tdof_nb_offsets;
00046 
00048    Array<int> ldof_sign;
00049 
00051    HypreParMatrix *P;
00052 
00053    ParNURBSExtension *pNURBSext()
00054    { return dynamic_cast<ParNURBSExtension *>(NURBSext); }
00055 
00056    GroupTopology &GetGroupTopo()
00057    { return (NURBSext) ? pNURBSext()->gtopo : pmesh->gtopo; }
00058 
00061    ParFiniteElementSpace(ParFiniteElementSpace &pf);
00062 
00063    // ldof_type = 0 : DOFs communicator, otherwise VDOFs communicator
00064    void GetGroupComm(GroupCommunicator &gcomm, int ldof_type,
00065                      Array<int> *ldof_sign = NULL);
00066 
00068    void GenerateGlobalOffsets();
00069 
00071    void ConstructTrueDofs();
00072    void ConstructTrueNURBSDofs();
00073 
00074 public:
00075    ParFiniteElementSpace(ParMesh *pm, FiniteElementCollection *f,
00076                          int dim = 1, int order = Ordering::byNODES);
00077 
00078    MPI_Comm GetComm() { return MyComm; }
00079    int GetNRanks() { return NRanks; }
00080    int GetMyRank() { return MyRank; }
00081 
00082    int TrueVSize()          { return ltdof_size; }
00083    int *GetDofOffsets()     { return dof_offsets; }
00084    int *GetTrueDofOffsets() { return tdof_offsets; }
00085    int GlobalVSize()        { return Dof_TrueDof_Matrix()->GetGlobalNumRows(); }
00086    int GlobalTrueVSize()    { return Dof_TrueDof_Matrix()->GetGlobalNumCols(); }
00087    int GetDofSign(int i)    { return NURBSext ? 1 : ldof_sign[VDofToDof(i)]; }
00088 
00090    virtual void GetElementDofs(int i, Array<int> &dofs) const;
00091 
00093    virtual void GetBdrElementDofs(int i, Array<int> &dofs) const;
00094 
00096    HypreParMatrix *Dof_TrueDof_Matrix();
00097 
00099    void DivideByGroupSize(double *vec);
00100 
00102    GroupCommunicator &GroupComm() { return *gcomm; }
00103 
00105    GroupCommunicator *ScalarGroupComm();
00106 
00109    void Synchronize(Array<int> &ldof_marker);
00110 
00112    virtual void GetEssentialVDofs(Array<int> &bdr_attr_is_ess,
00113                                   Array<int> &ess_dofs);
00114 
00117    int GetLocalTDofNumber(int ldof);
00119    int GetGlobalTDofNumber(int ldof);
00123    int GetGlobalScalarTDofNumber(int sldof);
00124 
00125    void Lose_Dof_TrueDof_Matrix();
00126    void LoseDofOffsets() { dof_offsets.LoseData(); }
00127    void LoseTrueDofOffsets() { tdof_offsets.LoseData(); }
00128 
00129    virtual void Update();
00131    virtual FiniteElementSpace *SaveUpdate();
00132 
00133    virtual ~ParFiniteElementSpace() { delete gcomm; delete P; }
00134 };
00135 
00136 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines