Commit 5b586a00 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Merge branch 'ticket/61-remove_GetMetricInfo_from_StdExpansion' into 'master'

Ticket/61 remove get metric info from std expansion

See merge request !831
parents 56f554e3 49f7b585
......@@ -15,6 +15,7 @@ v5.0.0
- Add ARPACK thirdparty build capabilities (!828)
- Added native support for csv files in addititon to pts (!760 !835)
- Utilize LAPACK_DIR env variable to find the native blas/lapack install (!827)
- Remove StdExpansion use from MultiRegion (use Expansions instead). (!831)
- Simplify RawType typedefs (!840)
- Remove unused files from BasicUtils (!841)
- Remove checks for old boost versions which are no longer supported (!841)
......@@ -41,24 +42,6 @@ v5.0.0
**Documentation**:
- Added the developer-guide repository as a submodule (!751)
<<<<<<< CHANGELOG.md
v4.4.2
------
**NekMesh**:
- Fix uninitialised memory bug in Nek5000 input module (!801)
**Library**
- Fix ability to set default implementation in Collections and added an option
to set eNoCollections in FieldConvert as default (!789)
- Fix performance issue in ProcessIsoContour in relation to memory consumption
(!821)
- Fix performance issue with ExtractPhysToBndElmt (!796)
**Utilities**
- Fix vtkToFld missing dependency which prevented compiling with VTK 7.1 (!808)
=======
>>>>>>> CHANGELOG.md
v4.4.1
------
**Library**
......
......@@ -36,6 +36,8 @@
#include <SpatialDomains/GeomFactors.h>
#include <Collections/CoalescedGeomData.h>
#include <LocalRegions/Expansion.h>
using namespace std;
namespace Nektar {
......@@ -73,11 +75,12 @@ const Array<OneD, const NekDouble> &CoalescedGeomData::GetJac(
int cnt = 0;
for(int i = 0; i < nElmts; ++i)
{
const Array<OneD, const NekDouble> jac =
pCollExp[i]->GetMetricInfo()->GetJac(ptsKeys);
const StdRegions::StdExpansion * sep = &(*pCollExp[i]);
const LocalRegions::Expansion * lep = dynamic_cast<const LocalRegions::Expansion*>( sep );
const Array<OneD, const NekDouble> jac = lep->GetMetricInfo()->GetJac( ptsKeys );
if (pCollExp[i]->GetMetricInfo()->GetGtype() ==
SpatialDomains::eDeformed)
if( lep->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed )
{
Vmath::Vcopy(npts, &jac[0], 1, &newjac[cnt], 1);
}
......@@ -119,11 +122,12 @@ const Array<OneD, const NekDouble> &CoalescedGeomData::GetJacWithStdWeights(
int cnt = 0;
for(int i = 0; i < nElmts; ++i)
{
const Array<OneD, const NekDouble> jac =
pCollExp[i]->GetMetricInfo()->GetJac(ptsKeys);
const StdRegions::StdExpansion * sep = &(*pCollExp[i]);
const LocalRegions::Expansion * lep = dynamic_cast<const LocalRegions::Expansion*>( sep );
const Array<OneD, const NekDouble> jac = lep->GetMetricInfo()->GetJac(ptsKeys);
if (pCollExp[i]->GetMetricInfo()->GetGtype() ==
SpatialDomains::eDeformed)
if( lep->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed )
{
Vmath::Vcopy(npts, &jac[0], 1, &newjac[cnt], 1);
}
......@@ -169,11 +173,12 @@ const Array<TwoD, const NekDouble> &CoalescedGeomData::GetDerivFactors(
int cnt = 0;
for(int i = 0; i < nElmts; ++i)
{
const Array<TwoD, const NekDouble> Dfac =
pCollExp[i]->GetMetricInfo()->GetDerivFactors(ptsKeys);
const StdRegions::StdExpansion * sep = &(*pCollExp[i]);
const LocalRegions::Expansion * lep = dynamic_cast<const LocalRegions::Expansion*>( sep );
const Array<TwoD, const NekDouble> Dfac = lep->GetMetricInfo()->GetDerivFactors( ptsKeys );
if (pCollExp[i]->GetMetricInfo()->GetGtype() ==
SpatialDomains::eDeformed)
if( lep->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed)
{
for (int j = 0; j < dim*coordim; ++j)
{
......
......@@ -97,11 +97,13 @@ void ProcessJacobianEnergy::Process(po::variables_map &vm)
// copy Jacobian into field
StdRegions::StdExpansionSharedPtr Elmt = exp->GetExp(i);
const StdRegions::StdExpansion * sep = &( *Elmt );
const LocalRegions::Expansion * lep = dynamic_cast<const LocalRegions::Expansion*>( lep );
int nquad = Elmt->GetTotPoints();
int coeffoffset = exp->GetCoeff_Offset(i);
Array<OneD, const NekDouble> Jac =
Elmt->GetMetricInfo()->GetJac(Elmt->GetPointsKeys());
if (Elmt->GetMetricInfo()->GetGtype() == SpatialDomains::eRegular)
Array<OneD, const NekDouble> Jac = lep->GetMetricInfo()->GetJac( Elmt->GetPointsKeys() );
if ( lep->GetMetricInfo()->GetGtype() == SpatialDomains::eRegular )
{
Vmath::Fill(nquad, Jac[0], phys, 1);
}
......@@ -110,7 +112,7 @@ void ProcessJacobianEnergy::Process(po::variables_map &vm)
Vmath::Vcopy(nquad, Jac, 1, phys, 1);
}
if (Elmt->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed)
if( lep->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed )
{
NekDouble jacmax = Vmath::Vmax(nquad, Jac, 1);
NekDouble jacmin = Vmath::Vmin(nquad, Jac, 1);
......
......@@ -163,12 +163,12 @@ void ProcessScalGrad::Process(po::variables_map &vm)
// identify boundary of element looking at.
boundary = BoundarytoTraceID[cnt];
const LocalRegions::Expansion * lep = dynamic_cast<const LocalRegions::Expansion*>( &( *bc ) );
// Get face normals
const SpatialDomains::GeomFactorsSharedPtr
m_metricinfo = bc->GetMetricInfo();
const SpatialDomains::GeomFactorsSharedPtr m_metricinfo = lep->GetMetricInfo();
const Array<OneD, const Array<OneD, NekDouble> >
normals = elmt->GetFaceNormal(boundary);
const Array<OneD, const Array<OneD, NekDouble> > normals = elmt->GetFaceNormal(boundary);
// initialise arrays
for (j = 0; j < ngrad; ++j)
......
......@@ -1076,7 +1076,7 @@ namespace Nektar
if( fabs(A[m][i][j]) > NekConstants::kNekZeroTol )
{
vertype[m] = eImplicit;
ASSERTL1(false,"Fully Impplicit schemes cannnot be handled by the TimeIntegrationScheme class");
ASSERTL1(false,"Fully Implicit schemes cannnot be handled by the TimeIntegrationScheme class");
}
}
}
......
......@@ -172,7 +172,7 @@ namespace Nektar
m_metricinfo = m_geom->GetGeomFactors();
}
const SpatialDomains::GeomFactorsSharedPtr& Expansion::v_GetMetricInfo() const
const SpatialDomains::GeomFactorsSharedPtr& Expansion::GetMetricInfo() const
{
return m_metricinfo;
}
......
......@@ -85,8 +85,7 @@ namespace Nektar
LOCAL_REGIONS_EXPORT void Reset();
LOCAL_REGIONS_EXPORT virtual const
SpatialDomains::GeomFactorsSharedPtr& v_GetMetricInfo() const;
LOCAL_REGIONS_EXPORT const SpatialDomains::GeomFactorsSharedPtr& GetMetricInfo() const;
LOCAL_REGIONS_EXPORT DNekMatSharedPtr BuildTransformationMatrix(
const DNekScalMatSharedPtr &r_bnd,
......
......@@ -33,7 +33,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <LocalRegions/Expansion.h>
#include <LocalRegions/MatrixKey.h>
namespace Nektar
......@@ -47,7 +47,7 @@ namespace Nektar
const StdRegions::VarCoeffMap &varCoeffMap,
LibUtilities::PointsType nodalType) :
StdMatrixKey(matrixType, shapeType, stdExpansion, factorMap, varCoeffMap, nodalType),
m_metricinfo(stdExpansion.GetMetricInfo())
m_metricinfo( ( dynamic_cast<const Expansion&>( stdExpansion ) ).GetMetricInfo() )
{
}
......
......@@ -344,9 +344,7 @@ namespace Nektar
traceEl->GetRightAdjacentElementVertex() != -1)
{
// Non-boundary edge (2 connected elements).
fwd = dynamic_cast<Nektar::StdRegions::StdExpansion*>
(traceEl->GetLeftAdjacentElementExp().get()) ==
(*m_exp)[n].get();
fwd = (traceEl->GetLeftAdjacentElementExp().get()) == (*m_exp)[n].get();
}
else
{
......
......@@ -1290,17 +1290,15 @@ namespace Nektar
}
}
}
else if (traceEl->GetLeftAdjacentElementEdge () != -1 &&
traceEl->GetRightAdjacentElementEdge() != -1)
else if ( traceEl->GetLeftAdjacentElementEdge () != -1 &&
traceEl->GetRightAdjacentElementEdge() != -1 )
{
// Non-boundary edge (2 connected elements).
fwd = dynamic_cast<Nektar::StdRegions::StdExpansion*>
(traceEl->GetLeftAdjacentElementExp().get()) ==
(*m_exp)[n].get();
fwd = ( traceEl->GetLeftAdjacentElementExp().get() == (*m_exp)[n].get() );
}
else
{
ASSERTL2(false, "Unconnected trace element!");
ASSERTL2( false, "Unconnected trace element!" );
}
return fwd;
......@@ -1852,7 +1850,6 @@ namespace Nektar
{
int i,j,n,cnt,cnt1,nbndry;
int nexp = GetExpSize();
StdRegions::StdExpansionSharedPtr BndExp;
Array<OneD,NekDouble> f(m_ncoeffs);
DNekVec F(m_ncoeffs,f,eWrapper);
......
......@@ -1652,9 +1652,7 @@ using namespace boost::assign;
traceEl->GetRightAdjacentElementFace() != -1)
{
// Non-boundary edge (2 connected elements).
fwd = dynamic_cast<Nektar::StdRegions::StdExpansion*>
(traceEl->GetLeftAdjacentElementExp().get()) ==
(*m_exp)[n].get();
fwd = (traceEl->GetLeftAdjacentElementExp().get() == (*m_exp)[n].get() );
}
else
{
......
......@@ -434,16 +434,15 @@ namespace Nektar
result->SetWaveSpace(GetWaveSpace());
}
void DisContField3DHomogeneous1D::GetBCValues(
Array<OneD, NekDouble> &BndVals,
const Array<OneD, NekDouble> &TotField,
int BndID)
void DisContField3DHomogeneous1D::GetBCValues( Array<OneD, NekDouble> & BndVals,
const Array<OneD, NekDouble> & TotField,
int BndID )
{
StdRegions::StdExpansionSharedPtr elmt;
StdRegions::StdExpansion1DSharedPtr temp_BC_exp;
LocalRegions::ExpansionSharedPtr elmt;
LocalRegions::Expansion1DSharedPtr temp_BC_exp;
Array<OneD, const NekDouble> tmp_Tot;
Array<OneD, NekDouble> tmp_BC;
Array<OneD, NekDouble> tmp_BC;
int cnt = 0;
int pos = 0;
......@@ -468,9 +467,10 @@ namespace Nektar
offset = GetPhys_Offset(elmtID);
elmt = GetExp(elmtID);
temp_BC_exp = std::dynamic_pointer_cast<
StdRegions::StdExpansion1D>(
LocalRegions::Expansion1D>(
m_bndCondExpansions[n]->GetExp(
i+k*exp_size_per_plane));
i + k * exp_size_per_plane )
);
elmt->GetEdgePhysVals(boundaryID, temp_BC_exp,
tmp_Tot = TotField + offset,
......@@ -489,8 +489,8 @@ namespace Nektar
Array<OneD, NekDouble> &outarray,
int BndID)
{
StdRegions::StdExpansionSharedPtr elmt;
StdRegions::StdExpansion1DSharedPtr temp_BC_exp;
LocalRegions::ExpansionSharedPtr elmt;
LocalRegions::Expansion1DSharedPtr temp_BC_exp;
Array<OneD, NekDouble> tmp_V1;
Array<OneD, NekDouble> tmp_V2;
......@@ -519,9 +519,10 @@ namespace Nektar
elmt = GetExp(elmtID);
temp_BC_exp = std::dynamic_pointer_cast<
StdRegions::StdExpansion1D>(
LocalRegions::Expansion1D>(
m_bndCondExpansions[n]->GetExp(
i+k*exp_size_per_plane));
i + k * exp_size_per_plane )
);
temp_BC_exp->NormVectorIProductWRTBase(
tmp_V1 = V1 + Phys_offset,
......@@ -580,43 +581,42 @@ namespace Nektar
/**
*/
void DisContField3DHomogeneous1D::v_GetBoundaryNormals(int i,
Array<OneD, Array<OneD, NekDouble> > &normals)
void DisContField3DHomogeneous1D::v_GetBoundaryNormals( int i,
Array<OneD, Array<OneD, NekDouble> > & normals )
{
int j, n, cnt, nq;
int expdim = GetCoordim(0);
int coordim = 3;
Array<OneD, NekDouble> tmp;
StdRegions::StdExpansionSharedPtr elmt;
int expdim = GetCoordim(0);
int coordim = 3;
Array<OneD, NekDouble> tmp;
LocalRegions::ExpansionSharedPtr elmt;
Array<OneD, int> ElmtID,EdgeID;
GetBoundaryToElmtMap(ElmtID,EdgeID);
// Initialise result
normals = Array<OneD, Array<OneD, NekDouble> > (coordim);
for (j = 0; j < coordim; ++j)
for (int j = 0; j < coordim; ++j)
{
normals[j] = Array<OneD, NekDouble> (
GetBndCondExpansions()[i]->GetTotPoints(), 0.0);
normals[j] = Array<OneD, NekDouble> ( GetBndCondExpansions()[i]->GetTotPoints(), 0.0 );
}
// Skip other boundary regions
for (cnt = n = 0; n < i; ++n)
int cnt = 0;
for( int n = 0; n < i; ++n )
{
cnt += GetBndCondExpansions()[n]->GetExpSize();
}
int offset;
for (n = 0; n < GetBndCondExpansions()[i]->GetExpSize(); ++n)
for( int n = 0; n < GetBndCondExpansions()[i]->GetExpSize(); ++n )
{
offset = GetBndCondExpansions()[i]->GetPhys_Offset(n);
nq = GetBndCondExpansions()[i]->GetExp(n)->GetTotPoints();
int nq = GetBndCondExpansions()[i]->GetExp(n)->GetTotPoints();
elmt = GetExp(ElmtID[cnt+n]);
const Array<OneD, const Array<OneD, NekDouble> > normalsElmt
= elmt->GetSurfaceNormal(EdgeID[cnt+n]);
// Copy to result
for (j = 0; j < expdim; ++j)
for (int j = 0; j < expdim; ++j)
{
Vmath::Vcopy(nq, normalsElmt[j], 1,
tmp = normals[j] + offset, 1);
......
......@@ -2842,13 +2842,13 @@ namespace Nektar
/**
*/
void ExpList::v_ExtractElmtToBndPhys(int i,
Array<OneD, NekDouble> &element,
Array<OneD, NekDouble> &boundary)
void ExpList::v_ExtractElmtToBndPhys( int i,
const Array<OneD, NekDouble> & element,
Array<OneD, NekDouble> & boundary)
{
int n, cnt;
Array<OneD, NekDouble> tmp1, tmp2;
StdRegions::StdExpansionSharedPtr elmt;
LocalRegions::ExpansionSharedPtr elmt;
Array<OneD, int> ElmtID,EdgeID;
GetBoundaryToElmtMap(ElmtID,EdgeID);
......@@ -2927,7 +2927,7 @@ namespace Nektar
{
int n, cnt;
Array<OneD, NekDouble> tmp1, tmp2;
StdRegions::StdExpansionSharedPtr elmt;
LocalRegions::ExpansionSharedPtr elmt;
Array<OneD, int> ElmtID,EdgeID;
GetBoundaryToElmtMap(ElmtID,EdgeID);
......@@ -2965,7 +2965,7 @@ namespace Nektar
int j, n, cnt, nq;
int coordim = GetCoordim(0);
Array<OneD, NekDouble> tmp;
StdRegions::StdExpansionSharedPtr elmt;
LocalRegions::ExpansionSharedPtr elmt;
Array<OneD, int> ElmtID,EdgeID;
GetBoundaryToElmtMap(ElmtID,EdgeID);
......@@ -3103,73 +3103,6 @@ namespace Nektar
return NullExpListSharedPtr;
}
StdRegions::StdExpansionSharedPtr GetStdExp(StdRegions::StdExpansionSharedPtr exp)
{
StdRegions::StdExpansionSharedPtr stdExp;
switch(exp->DetShapeType())
{
case LibUtilities::eSegment:
stdExp = MemoryManager<StdRegions::StdSegExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey());
break;
case LibUtilities::eTriangle:
{
StdRegions::StdNodalTriExpSharedPtr nexp;
if((nexp = exp->as<StdRegions::StdNodalTriExp>()))
{
stdExp = MemoryManager<StdRegions::StdNodalTriExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey(),
nexp->GetNodalPointsKey().GetPointsType());
}
else
{
stdExp = MemoryManager<StdRegions::StdTriExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey());
}
}
break;
case LibUtilities::eQuadrilateral:
stdExp = MemoryManager<StdRegions::StdQuadExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey());
break;
case LibUtilities::eTetrahedron:
stdExp = MemoryManager<StdRegions::StdTetExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey(),
exp->GetBasis(2)->GetBasisKey());
break;
case LibUtilities::ePyramid:
stdExp = MemoryManager<StdRegions::StdPyrExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey(),
exp->GetBasis(2)->GetBasisKey());
break;
case LibUtilities::ePrism:
stdExp = MemoryManager<StdRegions::StdPrismExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey(),
exp->GetBasis(2)->GetBasisKey());
break;
case LibUtilities::eHexahedron:
stdExp = MemoryManager<StdRegions::StdHexExp>
::AllocateSharedPtr(exp->GetBasis(0)->GetBasisKey(),
exp->GetBasis(1)->GetBasisKey(),
exp->GetBasis(2)->GetBasisKey());
break;
default:
ASSERTL0(false,"Shape type not setup");
break;
}
return stdExp;
}
/**
* @brief Construct collections of elements containing a single element
* type and polynomial order from the list of expansions.
......
......@@ -1346,17 +1346,17 @@ namespace Nektar
std::shared_ptr<ExpList> &result,
const bool DeclareCoeffPhysArrays);
virtual void v_ExtractElmtToBndPhys(int i,
Array<OneD, NekDouble> &elmt,
Array<OneD, NekDouble> &boundary);
virtual void v_ExtractElmtToBndPhys( const int i,
const Array<OneD, NekDouble> & elmt,
Array<OneD, NekDouble> & boundary );
virtual void v_ExtractPhysToBndElmt(int i,
const Array<OneD, const NekDouble> &phys,
Array<OneD, NekDouble> &bndElmt);
virtual void v_ExtractPhysToBndElmt( const int i,
const Array<OneD, const NekDouble> & phys,
Array<OneD, NekDouble> & bndElmt );
virtual void v_ExtractPhysToBnd(int i,
const Array<OneD, const NekDouble> &phys,
Array<OneD, NekDouble> &bnd);
virtual void v_ExtractPhysToBnd( const int i,
const Array<OneD, const NekDouble> & phys,
Array<OneD, NekDouble> & bnd );
virtual void v_GetBoundaryNormals(int i,
Array<OneD, Array<OneD, NekDouble> > &normals);
......
......@@ -722,7 +722,7 @@ namespace Nektar
int i,j,r;
// get the local element expansion of the elmId element
StdRegions::StdExpansionSharedPtr elmExp = GetExp(elmId);
LocalRegions::ExpansionSharedPtr elmExp = GetExp( elmId );
// Get the quadrature points and weights required for integration
int quad_npoints = elmExp->GetTotPoints();
......
......@@ -539,7 +539,7 @@ namespace Nektar
for(int i = 0; i < m_planes[n]->GetExpSize(); ++i)
{
StdRegions::StdExpansionSharedPtr exp = m_planes[n]->GetExp(i);
LocalRegions::ExpansionSharedPtr exp = m_planes[n]->GetExp( i );
Array<OneD, NekDouble> phys(exp->GetTotPoints());
exp->BwdTrans(m_planes[n]->GetCoeffs()+m_planes[n]->GetCoeff_Offset(i),
phys);
......
......@@ -316,7 +316,7 @@ namespace Nektar
DNekScalBlkMatSharedPtr loc_mat;
DNekScalMatSharedPtr tmp_mat;
StdRegions::StdExpansionSharedPtr vExp = expList->GetExp(n);
LocalRegions::ExpansionSharedPtr vExp = expList->GetExp( n );
// need to be initialised with zero size for non variable
// coefficient case
......@@ -390,7 +390,7 @@ namespace Nektar
{
std::shared_ptr<MultiRegions::ExpList> expList = m_expList.lock();
StdRegions::StdExpansionSharedPtr vExp = expList->GetExp(n);
LocalRegions::ExpansionSharedPtr vExp = expList->GetExp( n );
// need to be initialised with zero size for non variable
// coefficient case
......
......@@ -227,7 +227,7 @@ namespace Nektar
{
RobinBCInfoSharedPtr rBC;
Array<OneD, NekDouble> tmp;
StdRegions::StdExpansionSharedPtr vExp = expList->GetExp(nel);
LocalRegions::ExpansionSharedPtr vExp = expList->GetExp(nel);
// add local matrix contribution
for(rBC = m_robinBCInfo.find(nel)->second;rBC; rBC = rBC->next)
......
......@@ -36,13 +36,13 @@
#ifndef NEKTAR_LIB_MULTIREGIONS_PRECONDITIONER_H
#define NEKTAR_LIB_MULTIREGIONS_PRECONDITIONER_H
#include <MultiRegions/GlobalLinSys.h>
#include <MultiRegions/MultiRegionsDeclspec.h>
#include <StdRegions/StdExpansion.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LinearAlgebra/NekTypeDefs.hpp>
#include <LibUtilities/Communication/Comm.h>
#include <LibUtilities/Communication/GsLib.hpp>
#include <LibUtilities/LinearAlgebra/NekTypeDefs.hpp>
#include <MultiRegions/GlobalLinSys.h>
#include <MultiRegions/MultiRegionsDeclspec.h>
#include <memory>
namespace Nektar
......
......@@ -102,7 +102,7 @@ namespace Nektar
std::shared_ptr<MultiRegions::ExpList> expList =
((m_linsys.lock())->GetLocMat()).lock();
StdRegions::StdExpansionSharedPtr locExpansion;
LocalRegions::ExpansionSharedPtr locExpansion;
int i,j,n,cnt,gid1,gid2;
NekDouble sign1,sign2,value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment