Skip to content
Permalink
Browse files

Merge branch 'python_comp_spaces' into 'master'

Python comp spaces

See merge request jschoeberl/ngsolve!294
  • Loading branch information
JSchoeberl committed Feb 6, 2018
2 parents 85028aa + a84afa8 commit 06b1f782dd55fb1474767470eb335cd7331ab884
@@ -74,6 +74,7 @@ namespace ngcomp
#include "vectorfacetfespace.hpp"
#include "periodic.hpp"


#include "facetsurffespace.hpp"

// #include "bddc.hpp"
@@ -115,6 +115,7 @@ namespace ngcomp
: FESpace(ama, flags)
{
name="FacetFESpace(facet)";
type = "facet";
// defined flags
DefineNumFlag("relorder");
DefineDefineFlag("variableorder");
@@ -875,7 +876,8 @@ namespace ngcomp
HybridDGFESpace :: HybridDGFESpace (shared_ptr<MeshAccess> ama,
const Flags & flags)
: CompoundFESpace (ama, flags)
{
{
type = "HDG";
Flags l2flags(flags), facetflags(flags);

int order = int (flags.GetNumFlag ("order", 1));
@@ -118,6 +118,7 @@ namespace ngcomp
: FESpace(ama, flags)
{
name="FacetSurfaceFESpace(facet)";
type = "facetsurface";
// defined flags
DefineNumFlag("relorder");
DefineDefineFlag("variableorder");
@@ -72,6 +72,7 @@ namespace ngcomp
: FESpace (ama, flags)
{
name = "H1HighOrderFESpace(h1ho)";
type = "h1ho";
// define h1ho flags
DefineDefineFlag("h1ho");
DefineNumFlag("relorder");
@@ -1782,13 +1783,12 @@ namespace ngcomp
};


class VectorH1FESpace : public CompoundFESpace
{
public:
VectorH1FESpace (shared_ptr<MeshAccess> ama, const Flags & flags,
bool checkflags = false)

VectorH1FESpace::VectorH1FESpace (shared_ptr<MeshAccess> ama, const Flags & flags,
bool checkflags)
: CompoundFESpace(ama, flags)
{
type = "VectorH1";
for (int i = 0; i < ma->GetDimension(); i++)
AddSpace (make_shared<H1HighOrderFESpace> (ama, flags));

@@ -1813,7 +1813,6 @@ namespace ngcomp
// integrator[VOL] = make_shared<VectorH1MassIntegrator<2>>(one);
}
}
};



@@ -133,6 +133,14 @@ namespace ngcomp

};


class VectorH1FESpace : public CompoundFESpace
{
public:
VectorH1FESpace (shared_ptr<MeshAccess> ama, const Flags & flags,
bool checkflags = false);
};

}

#endif
@@ -432,6 +432,7 @@ namespace ngcomp
HDivDivFESpace :: HDivDivFESpace (shared_ptr<MeshAccess> ama,const Flags & flags,bool checkflags)
: FESpace(ama,flags)
{
type = "hdivdiv";
order = int (flags.GetNumFlag ("order",1));
plus = flags.GetDefineFlag ("plus");
discontinuous = flags.GetDefineFlag("discontinuous");
@@ -244,6 +244,7 @@ namespace ngcomp
const Flags & aflags, bool parseflags)
: FESpace(ama, aflags)
{
type = "hdivdivsurf";
order = aflags.GetNumFlag("order", 0);
DefineNumFlag("discontinuous");

@@ -59,7 +59,8 @@ namespace ngcomp
: FESpace (ama, flags)
{
name="L2HighOrderFESpace(l2ho)";

type = "l2ho";

// defined flags
DefineNumFlag("relorder");
DefineDefineFlag("l2ho");
@@ -686,6 +687,7 @@ namespace ngcomp
L2SurfaceHighOrderFESpace (shared_ptr<MeshAccess> ama, const Flags & flags, bool parseflags)
: FESpace (ama, flags)
{
type = "l2surf";
name="L2SurfaceHighOrderFESpace(l2surf)";
// defined flags
DefineDefineFlag("l2surf");
@@ -950,13 +952,12 @@ namespace ngcomp



class VectorL2FESpace : public CompoundFESpace
{
public:
VectorL2FESpace (shared_ptr<MeshAccess> ama, const Flags & flags,
bool checkflags = false)

VectorL2FESpace::VectorL2FESpace (shared_ptr<MeshAccess> ama, const Flags & flags,
bool checkflags)
: CompoundFESpace(ama, flags)
{
type = "VectorL2";
for (int i = 0; i < ma->GetDimension(); i++)
AddSpace (make_shared<L2HighOrderFESpace> (ama, flags));

@@ -974,8 +975,6 @@ namespace ngcomp
break;
}
}
};


static RegisterFESpace<VectorL2FESpace> initvecl2 ("VectorL2");

@@ -171,6 +171,13 @@ namespace ngcomp

};


class VectorL2FESpace : public CompoundFESpace
{
public:
VectorL2FESpace (shared_ptr<MeshAccess> ama, const Flags & flags, bool checkflags = false);
};

}

#endif
@@ -1,4 +1,5 @@
#include <comp.hpp>
#include "numberfespace.hpp"

namespace ngcomp
{
@@ -59,12 +60,10 @@ namespace ngcomp



class NumberFESpace : public FESpace
{
public:
NumberFESpace (shared_ptr<MeshAccess> ama, const Flags & flags, bool checkflags=false)
NumberFESpace::NumberFESpace (shared_ptr<MeshAccess> ama, const Flags & flags, bool checkflags)
: FESpace (ama, flags)
{
{
type = "number";
evaluator[VOL] = make_shared<T_DifferentialOperator<NumberDiffOp>>();
evaluator[BND] = make_shared<T_DifferentialOperator<NumberDiffOp>>();
evaluator[BBND] = make_shared<T_DifferentialOperator<NumberDiffOp>>();
@@ -73,22 +72,21 @@ namespace ngcomp
is_atomic_dof = true;
}

virtual void Update(LocalHeap & lh) override
void NumberFESpace::Update(LocalHeap & lh)
{
SetNDof(1);
}

// virtual size_t GetNDof() const { return 1; }

virtual FiniteElement & GetFE (ElementId ei, Allocator & lh) const override

FiniteElement & NumberFESpace::GetFE (ElementId ei, Allocator & lh) const
{
if (DefinedOn(ei))
return *new (lh) NumberFiniteElement(ma->GetElType(ei));
else
return *new (lh) DummyFE<ET_POINT>();
}

virtual void GetDofNrs (ElementId ei, Array<int> & dnums) const override
void NumberFESpace::GetDofNrs (ElementId ei, Array<int> & dnums) const
{
if (DefinedOn(ei))
{
@@ -99,7 +97,6 @@ namespace ngcomp
dnums.SetSize(0);
}

};


static RegisterFESpace<NumberFESpace> init ("number");
@@ -0,0 +1,29 @@
#ifndef FILE_NUMBERFESPACE
#define FILE_NUMBERFESPACE

/*********************************************************************/
/* File: numberfespace.hpp */
/* Author: Start */
/* Date: 30.FJan. 2018 */
/*********************************************************************/


namespace ngcomp
{

class NumberFESpace : public FESpace
{
public:
NumberFESpace (shared_ptr<MeshAccess> ama, const Flags & flags, bool checkflags=false);
virtual void Update(LocalHeap & lh) override;

// virtual size_t GetNDof() const { return 1; }

virtual FiniteElement & GetFE (ElementId ei, Allocator & lh) const override;

virtual void GetDofNrs (ElementId ei, Array<int> & dnums) const override;

};

}
#endif

0 comments on commit 06b1f78

Please sign in to comment.