MFEM v2.0
|
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_PGRIDFUNC 00013 #define MFEM_PGRIDFUNC 00014 00016 class ParGridFunction : public GridFunction 00017 { 00018 protected: 00019 ParFiniteElementSpace *pfes; 00020 00021 public: 00022 ParGridFunction() { pfes = NULL; } 00023 00024 ParGridFunction(ParFiniteElementSpace *pf) : GridFunction(pf), pfes(pf) { } 00025 00028 ParGridFunction(ParFiniteElementSpace *pf, GridFunction *gf); 00029 00032 ParGridFunction(ParFiniteElementSpace *pf, HypreParVector *tv); 00033 00036 ParGridFunction(ParMesh *pmesh, GridFunction *gf); 00037 00038 ParGridFunction &operator=(double value) 00039 { GridFunction::operator=(value); return *this; } 00040 00041 ParGridFunction &operator=(const Vector &v) 00042 { GridFunction::operator=(v); return *this; } 00043 00044 ParFiniteElementSpace *ParFESpace() { return pfes; } 00045 00046 void Update(ParFiniteElementSpace *f); 00047 00048 void Update(ParFiniteElementSpace *f, Vector &v, int v_offset); 00049 00052 void Distribute(HypreParVector *tv); 00053 00055 ParGridFunction &operator=(HypreParVector &tv) 00056 { Distribute(&tv); return (*this); } 00057 00059 void ParallelAverage(HypreParVector &tv); 00060 00062 HypreParVector *ParallelAverage(); 00063 00064 double ComputeL1Error(Coefficient *exsol[], 00065 const IntegrationRule *irs[] = NULL) const; 00066 00067 double ComputeL1Error(VectorCoefficient &exsol, 00068 const IntegrationRule *irs[] = NULL) const; 00069 00070 double ComputeL2Error(Coefficient *exsol[], 00071 const IntegrationRule *irs[] = NULL) const; 00072 00073 double ComputeL2Error(VectorCoefficient &exsol, 00074 const IntegrationRule *irs[] = NULL, 00075 Array<int> *elems = NULL) const; 00076 00077 double ComputeMaxError(Coefficient *exsol[], 00078 const IntegrationRule *irs[] = NULL) const; 00079 00080 double ComputeMaxError(VectorCoefficient &exsol, 00081 const IntegrationRule *irs[] = NULL) const; 00082 00086 virtual void Save(ostream &out); 00087 00089 void SaveAsOne(ostream &out = cout); 00090 00091 virtual ~ParGridFunction() { } 00092 }; 00093 00094 #endif