Commit a9b40882 authored by Spencer Sherwin's avatar Spencer Sherwin

First pass of coding standard formatting


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@54 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent cd37bb6a
#include <MultiRegions/ContExpList1D.h>
///////////////////////////////////////////////////////////////////////////////
//
// File ContExpList1D.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Continuous Expansion list definition in 1D
//
///////////////////////////////////////////////////////////////////////////////
namespace MultiRegions{
#include <MultiRegions/ContExpList1D.h>
ContExpList1D::ContExpList1D(){
_Mass = (StdRegions::StdMatContainer *)NULL;
_LocToContMap = (int *)NULL;
namespace Nektar
{
namespace MultiRegions
{
ContExpList1D::ContExpList1D()
{
m_mass = (StdRegions::StdMatContainer *)NULL;
m_locToContMap = (int *)NULL;
}
ContExpList1D::~ContExpList1D(){
if(_cont_coeffs)
delete[] _cont_coeffs;
if(_LocToContMap)
delete[] _LocToContMap;
}
ContExpList1D::~ContExpList1D()
{
if(m_contCoeffs)
{
delete[] m_contCoeffs;
}
if(m_locToContMap)
{
delete[] m_locToContMap;
}
}
ContExpList1D::ContExpList1D(const StdRegions::BasisKey &Ba,
SpatialDomains::MeshGraph1D &graph1D):ExpList1D(Ba,graph1D){
int gid,i,j;
int order = Ba.get_order();
ContExpList1D::ContExpList1D(const StdRegions::BasisKey &Ba,
SpatialDomains::MeshGraph1D &graph1D):
ExpList1D(Ba,graph1D)
{
int gid,i,j;
int order = Ba.GetBasisOrder();
ASSERTL1((Ba.get_Btype() == StdRegions::Modified_A)
||(Ba.get_Btype() == StdRegions::GLL_Lagrange),
"ConExpList1D::ConExpList1D",
"Expansion not of an boundary-interior type");
ASSERTL1((Ba.GetBasisType() == StdRegions::Modified_A)
||(Ba.GetBasisType() == StdRegions::GLL_Lagrange),
"Expansion not of an boundary-interior type");
_Mass = (StdRegions::StdMatContainer *)NULL;
m_mass = (StdRegions::StdMatContainer *)NULL;
_LocToContMap = new int [_ncoeffs];
Vmath::fill(_ncoeffs,-1,_LocToContMap,1);
// set up mapping based
StdRegions::StdExpMap vmap;
m_locToContMap = new int [m_ncoeffs];
Vmath::Fill(m_ncoeffs,-1,m_locToContMap,1);
// set up mapping based
StdRegions::StdExpMap vmap;
// assume all elements have the same mapping and expasion order
_Seg[0]->MapTo(StdRegions::Forwards, vmap);
// assume all elements have the same mapping and expasion order
m_seg[0]->MapTo(StdRegions::eForwards, vmap);
// set up simple map;
for(gid = i = 0; i < _Seg.size(); ++i,++gid)
for(j = 0; j < 2; ++j)
_LocToContMap[order*i+vmap[j]] = gid+j;
++gid;
for(i = 0; i < _Seg.size(); ++i)
for(j = 0; j < order; ++j)
if(_LocToContMap[order*i+j] == -1)
_LocToContMap[order*i+j] = gid++;
_cont_ncoeffs = gid;
_cont_coeffs = new double [_cont_ncoeffs];
}
void ContExpList1D::IProduct_WRT_B(const double *inarray, double *outarray){
ExpList1D::IProduct_WRT_B(inarray,_coeffs);
Assemble(_coeffs,outarray);
_trans_state = LocalCont;
}
void ContExpList1D::FwdTrans(const double *inarray){
IProduct_WRT_B(inarray,_cont_coeffs);
if(!_Mass) GenMassMatrix();
_Mass->Solve(_cont_coeffs,1);
_trans_state = Continuous;
_phys_state = false;
}
// set up simple map;
for(gid = i = 0; i < _Seg.size(); ++i,++gid)
{
for(j = 0; j < 2; ++j)
{
m_locToContMap[order*i+vmap[j]] = gid+j;
}
}
++gid;
for(i = 0; i < m_seg.size(); ++i)
{
for(j = 0; j < order; ++j)
{
if(m_locToContMap[order*i+j] == -1)
{
m_locToContMap[order*i+j] = gid++;
}
}
}
void ContExpList1D::BwdTrans(double *outarray){
m_contNcoeffs = gid;
m_contCoeffs = new double [m_contNcoeffs];
}
void ContExpList1D::IProductWRTBase(const double *inarray, double *outarray)
{
ExpList1D::IProductWRTBase(inarray,m_coeffs);
Assemble(m_coeffs,outarray);
m_transState = LocalCont;
}
if(_trans_state == Continuous)
ContToLocal();
void ContExpList1D::FwdTrans(const double *inarray)
{
IProductWRTBase(inarray,m_contcoeffs);
if(!m_mass)
{
GenMassMatrix();
}
m_mass->Solve(m_contCoeffs,1);
m_transTtate = eContinuous;
m_physState = false;
}
ExpList1D::BwdTrans(outarray);
}
void ContExpList1D::BwdTrans(double *outarray)
{
if(_transState == eContinuous)
{
ContToLocal();
}
void ContExpList1D::GenMassMatrix(void){
if(!_Mass){
int i,j,cnt,gid1,gid2,loc_lda;
double *loc_mat;
StdRegions::StdMatContainer *loc_mass;
vector<LocalRegions::SegExp *>::iterator def;
ExpList1D::BwdTrans(outarray);
}
double *mmat = new double [_cont_ncoeffs*_cont_ncoeffs];
Vmath::zero(_cont_ncoeffs*_cont_ncoeffs,mmat,1);
void ContExpList1D::GenMassMatrix(void)
{
if(!m_mass)
{
int i,j,cnt,gid1,gid2,loc_lda;
double *loc_mat;
StdRegions::StdMatContainer *loc_mass;
vector<LocalRegions::SegExp *>::iterator def;
double *mmat = new double [m_contNcoeffs*m_contNcoeffs];
Vmath::Zero(m_contNcoeffs*m_contNcoeffs,mmat,1);
_Mass = new StdRegions::StdMatContainer(mmat);
_Mass->set_lda (_cont_ncoeffs);
_Mass->set_mat_form (StdRegions::Symmetric_Positive);
m_mass = new StdRegions::StdMatContainer(mmat);
m_mass->SetLda (m_contNcoeffs);
m_mass->SetMatForm (StdRegions::eSymmetric_Positive);
// fill global matrix
for(cnt = 0, def = _Seg.begin(); def != _Seg.end(); ++def){
loc_mass = (*def)->GetMassMatrix();
loc_lda = loc_mass->get_lda();
loc_mat = loc_mass->get_matrix();
for(cnt = 0, def = m_seg.begin(); def != m_seg.end(); ++def)
{
loc_mass = (*def)->GetMassMatrix();
loc_lda = loc_mass->GetLda();
loc_mat = loc_mass->GetMatrix();
for(i = 0; i < loc_lda; ++i){
gid1 = _LocToContMap[i+cnt];
for(j = 0; j < loc_lda; ++j){
gid2 = _LocToContMap[j+cnt];
mmat[gid1*_cont_ncoeffs + gid2] += loc_mat[i*loc_lda + j];
for(i = 0; i < loc_lda; ++i)
{
gid1 = m_locToContMap[i+cnt];
for(j = 0; j < loc_lda; ++j)
{
gid2 = m_locToContMap[j+cnt];
mmat[gid1*m_contNcoeffs + gid2] += loc_mat[i*loc_lda + j];
}
}
cnt+=(*def)->getNcoeffs();
}
cnt+=(*def)->get_ncoeffs();
}
}
}
} //end of namespace
} //end of namespace
#ifndef H_CONTEXPLIST1D
#include <MultiRegions/MultiRegions.h>
///////////////////////////////////////////////////////////////////////////////
//
// File ContExpList1D.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Continusou Expansion list definition in 1D
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CONTEXPLIST1D_H
#define CONTEXPLIST1D_H
#include <MultiRegions/MultiRegions.hpp>
#include <MultiRegions/ExpList1D.h>
#include <StdRegions/StdMatrix.h>
namespace MultiRegions{
class ContExpList1D: public ExpList1D {
private:
int _cont_ncoeffs;
int *_LocToContMap;
double *_cont_coeffs;
namespace Nektar
{
namespace MultiRegions
{
StdRegions::StdMatContainer *_Mass;
protected:
public:
ContExpList1D();
ContExpList1D(const StdRegions::BasisKey &Ba,
SpatialDomains::MeshGraph1D &graph1D);
~ContExpList1D();
inline int get_cont_ncoeffs(){
return _cont_ncoeffs;
}
inline double *get_cont_coeffs(){
return _cont_coeffs;
}
class ContExpList1D:
public ExpList1D
{
public:
ContExpList1D();
ContExpList1D(const StdRegions::BasisKey &Ba,
SpatialDomains::MeshGraph1D &graph1D);
~ContExpList1D();
inline int getContNcoeffs()
{
return m_contNcoeffs;
}
inline double *get_cont_coeffs()
{
return m_contCoeffs;
}
inline void ContToLocal(){
ContToLocal(_cont_coeffs,_coeffs);
}
inline void ContToLocal(const double *cont,double *loc){
Vmath::gathr(_ncoeffs,cont,_LocToContMap,loc);
}
inline void LocalToCont(){
LocalToCont(_coeffs,_cont_coeffs);
}
inline void LocalToCont(const double *loc, double *cont){
Vmath::scatr(_ncoeffs,loc,_LocToContMap,cont);
}
inline void Assemble(){
Assemble(_coeffs,_cont_coeffs);
}
inline void Assemble(const double *loc, double *cont){
Vmath::zero(_cont_ncoeffs,cont,1);
Vmath::assmb(_ncoeffs,loc,_LocToContMap,cont);
}
inline void ContToLocal()
{
ContToLocal(m_contCoeffs,m_coeffs);
}
inline void ContToLocal(const double *cont,double *loc)
{
Vmath::Gathr(m_ncoeffs,cont,m_locToContMap,loc);
}
inline void LocalToCont()
{
LocalToCont(m_coeffs,m_contCoeffs);
}
inline void LocalToCont(const double *loc, double *cont)
{
Vmath::Scatr(m_ncoeffs,loc,m_locToContMap,cont);
}
inline void Assemble()
{
Assemble(m_coeffs,m_contCoeffs);
}
inline void Assemble(const double *loc, double *cont)
{
Vmath::Zero(m_contNcoeffs,cont,1);
Vmath::Assmb(m_ncoeffs,loc,m_locToContMap,cont);
}
void IProduct_WRT_B(const double *inarray, double *outarray);
void FwdTrans(const double *inarray);
void IProductWRTBase(const double *inarray, double *outarray);
void FwdTrans(const double *inarray);
void BwdTrans(double *outarray);
void BwdTrans(double *outarray);
void GenMassMatrix(void);
virtual void V_BwdTrans(double *outarray){
BwdTrans(outarray);
}
void GenMassMatrix(void);
protected:
};
private:
int m_contNcoeffs;
int *m_locToContMap;
double *m_contCoeffs;
StdRegions::StdMatContainer *m_mass;
virtual void v_BwdTrans(double *outarray)
{
BwdTrans(outarray);
}
};
} //end of namespace
} //end of namespace
#define H_CONTEXPLIST1D
#endif
#endif // end of define
///////////////////////////////////////////////////////////////////////////////
//
// File DisContExpList1D.h
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Discontinuous Galerkin Expansion List in 1D, Header file
//
///////////////////////////////////////////////////////////////////////////////
#include <MultiRegions/DisContExpList1D.h>
namespace MultiRegions{
namespace Nektar
{
namespace MultiRegions
{
DisContExpList1D::DisContExpList1D(){
}
DisContExpList1D::DisContExpList1D()
{
}
DisContExpList1D::~DisContExpList1D(){
}
DisContExpList1D::~DisContExpList1D()
{
}
} //end of namespace
} //end of namespace
#ifndef H_DISCONTEXPLIST1D
///////////////////////////////////////////////////////////////////////////////
//
// File DisContExpList1D.h
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Discontinuous Galerkin Expansion List in 1D, Header file
//
///////////////////////////////////////////////////////////////////////////////
#ifndef DISCONTEXPLIST1D_H
#define DISCONTEXPLIST1D_H
#include <MultiRegions/MultiRegions.h>
#include <MultiRegions/MultiRegions.hpp>
#include <MultiRegions/ExpList1D.h>
namespace MultiRegions{
namespace Nektar
{
namespace MultiRegions
{
class DisContExpList1D: public ExpList1D {
private:
protected:
public:
DisContExpList1D();
~DisContExpList1D();
};
class DisContExpList1D:
public ExpList1D
{
public:
DisContExpList1D();
~DisContExpList1D();
protected:
private:
};
} //end of namespace
} //end of namespace
#define H_DISCONTEXPLIST1D
#endif
......@@ -42,8 +42,8 @@ namespace Nektar
ExpList::ExpList()
{
m_TransState = NotSet;
m_PhysState = false;
m_transState = eNotSet;
m_physState = false;
}
ExpList::~ExpList()
......
......@@ -37,6 +37,7 @@
#define H_EXPLIST
#include <MultiRegions/MultiRegions.hpp>
#include <LibUtilities/NekMemoryManager.hpp>
namespace Nektar
{
......@@ -55,6 +56,7 @@ namespace Nektar
}
inline int GetPointsTot(void)
{
return m_npoints;
}
......@@ -68,21 +70,21 @@ namespace Nektar
return (m_phys);
}
inline void SetTransState(TransState trans_state)
inline void SetTransState(TransState transState)
{
m_transState = trans_state;
m_transState = transState;
}
inline void SetPhysState(bool phys_state)
inline void SetPhysState(bool physState)
{
m_physState = phys_state;
m_physState = physState;
}
void BwdTrans (double *outarray)
{
v_BwdTrans (outarray);
}
protected:
int m_ncoeffs;
int m_npoints;
......
......@@ -50,11 +50,6 @@ namespace Nektar
namespace MultiRegions
{
typedef boost::shared_ptr<SegExp> SharedSegExpPtr;
typedef std::vector< SharedSegExpPtr > SegExpVector;
typedef std::vector< SharedSegExpPtr >::iterator SegExpVectorIter;
class ExpList1D:
public ExpList
{
......@@ -82,16 +77,15 @@ namespace Nektar
inline int GetCoordim(int eid)
{
ASSERTL2(eid <= m_seg.size(),"ExpList1D:get_coordim()",
"eid is larger than number of elements");
return m_seg[eid]->GetCoordim();
ASSERTL2(eid <= m_seg.size(),"eid is larger than number of elements");
return ((LocalRegions::SegExp *)(m_seg[eid]))->GetCoordim();
}
double Linf (const double *sol);
double L2 (const double *sol);
protected:
SegExpVector m_seg;
StdRegions::ExpVector m_seg;
private:
......
///////////////////////////////////////////////////////////////////////////////
//
// File ExpList2D.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Expansion list 2D definition
//
///////////////////////////////////////////////////////////////////////////////
#include <MultiRegions/ExpList2D.h>
namespace MultiRegions{
ExpList2D::ExpList2D(){
}