Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76908049c3 | ||
|
|
3dcac2417e |
@@ -140,12 +140,12 @@ void Hybridization::ConstructC()
|
||||
bdr_attr_marker = 0;
|
||||
for (size_t k = 0; k < boundary_constraint_integs.size(); k++)
|
||||
{
|
||||
if (boundary_constraint_integs_marker[k] == NULL)
|
||||
if (boundary_constraint_integs_marker[k].IsEmpty())
|
||||
{
|
||||
bdr_attr_marker = 1;
|
||||
break;
|
||||
}
|
||||
Array<int> &bdr_marker = *boundary_constraint_integs_marker[k];
|
||||
Array<int> &bdr_marker = boundary_constraint_integs_marker[k];
|
||||
MFEM_ASSERT(bdr_marker.Size() == bdr_attr_marker.Size(),
|
||||
"invalid boundary marker for boundary face integrator #"
|
||||
<< k << ", counting from zero");
|
||||
@@ -181,8 +181,8 @@ void Hybridization::ConstructC()
|
||||
fe2 = fe1;
|
||||
for (size_t k = 0; k < boundary_constraint_integs.size(); k++)
|
||||
{
|
||||
if (boundary_constraint_integs_marker[k] &&
|
||||
(*boundary_constraint_integs_marker[k])[bdr_attr-1] == 0) { continue; }
|
||||
if (boundary_constraint_integs_marker[k].Size() &&
|
||||
boundary_constraint_integs_marker[k][bdr_attr-1] == 0) { continue; }
|
||||
|
||||
boundary_constraint_integs[k]->AssembleFaceMatrix(*face_el, *fe1, *fe2, *FTr,
|
||||
elmat);
|
||||
|
||||
+47
-21
@@ -20,6 +20,21 @@
|
||||
namespace mfem
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> Owning(T *t) { return std::shared_ptr<T>(t); }
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> NonOwning(T *t)
|
||||
{
|
||||
return std::shared_ptr<T>(t, [](T*) {});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> OptionallyOwning(T *t, bool own)
|
||||
{
|
||||
return own ? Owning(t) : NonOwning(t);
|
||||
}
|
||||
|
||||
/** @brief Auxiliary class Hybridization, used to implement BilinearForm
|
||||
hybridization.
|
||||
|
||||
@@ -69,10 +84,10 @@ protected:
|
||||
std::unique_ptr<class HybridizationExtension> ext;
|
||||
/// The constraint integrator.
|
||||
std::unique_ptr<BilinearFormIntegrator> c_bfi;
|
||||
/// The constraint boundary face integrators
|
||||
std::vector<std::unique_ptr<BilinearFormIntegrator>> boundary_constraint_integs;
|
||||
/// Boundary markers for constraint face integrators
|
||||
std::vector<Array<int>*> boundary_constraint_integs_marker;
|
||||
/// The constraint boundary face integrators.
|
||||
std::vector<std::shared_ptr<BilinearFormIntegrator>> boundary_constraint_integs;
|
||||
/// Boundary markers for constraint face integrators.
|
||||
std::vector<Array<int>> boundary_constraint_integs_marker;
|
||||
/// The constraint matrix.
|
||||
std::unique_ptr<SparseMatrix> Ct;
|
||||
/// The Schur complement system for the Lagrange multiplier.
|
||||
@@ -128,30 +143,41 @@ public:
|
||||
void SetConstraintIntegrator(BilinearFormIntegrator *c_integ)
|
||||
{ c_bfi.reset(c_integ); }
|
||||
|
||||
/** Add the boundary face integrator that will be used to construct the
|
||||
constraint matrix C. The Hybridization object assumes ownership of the
|
||||
integrator, i.e. it will delete the integrator when destroyed. */
|
||||
void AddBdrConstraintIntegrator(BilinearFormIntegrator *c_integ)
|
||||
/// @brief Add a boundary face integrator that will be used to construct the
|
||||
/// constraint matrix C.
|
||||
///
|
||||
/// The integrator will apply to the boundaries specified using the marker
|
||||
/// array @a bdr_marker. If @a bdr_marker is empty (its default value) then
|
||||
/// the integrator will be applied on all boundaries.
|
||||
void AddBdrConstraintIntegrator(
|
||||
const std::shared_ptr<BilinearFormIntegrator> &c_integ,
|
||||
const Array<int> &bdr_marker = Array<int>())
|
||||
{
|
||||
boundary_constraint_integs.emplace_back(c_integ);
|
||||
boundary_constraint_integs_marker.push_back(nullptr);
|
||||
boundary_constraint_integs.push_back(c_integ);
|
||||
boundary_constraint_integs_marker.push_back(bdr_marker);
|
||||
}
|
||||
|
||||
/// @brief Add the boundary face integrator that will be used to construct
|
||||
/// the constraint matrix C.
|
||||
///
|
||||
/// If @a own is true (its default value), then the Hybridization object
|
||||
/// assumes ownership of the integrator.
|
||||
///
|
||||
/// @sa AddBdrConstraintIntegrator().
|
||||
void AddBdrConstraintIntegrator(BilinearFormIntegrator *c_integ,
|
||||
Array<int> &bdr_marker)
|
||||
const Array<int> &bdr_marker = Array<int>(),
|
||||
bool own = true)
|
||||
{
|
||||
boundary_constraint_integs.emplace_back(c_integ);
|
||||
boundary_constraint_integs_marker.push_back(&bdr_marker);
|
||||
AddBdrConstraintIntegrator(OptionallyOwning(c_integ, own), bdr_marker);
|
||||
}
|
||||
|
||||
/// Access all integrators added with AddBdrConstraintIntegrator().
|
||||
BilinearFormIntegrator& GetBdrConstraintIntegrator(int i)
|
||||
{ return *boundary_constraint_integs[i]; }
|
||||
/// Access the integrators added with AddBdrConstraintIntegrator().
|
||||
const std::vector<std::shared_ptr<BilinearFormIntegrator>>
|
||||
&GetBdrConstraintIntegrators() const { return boundary_constraint_integs; }
|
||||
|
||||
/// Access all boundary markers added with AddBdrConstraintIntegrator().
|
||||
/** If no marker was specified when the integrator was added, the
|
||||
corresponding pointer (to Array<int>) will be NULL. */
|
||||
Array<int>* GetBdrConstraintIntegratorMarker(int i)
|
||||
{ return boundary_constraint_integs_marker[i]; }
|
||||
/// Access the boundary markers added with AddBdrConstraintIntegrator().
|
||||
const std::vector<Array<int>> &GetBdrConstraintIntegratorMarker() const
|
||||
{ return boundary_constraint_integs_marker; }
|
||||
|
||||
/// Prepare the Hybridization object for assembly.
|
||||
void Init(const Array<int> &ess_tdof_list);
|
||||
|
||||
Reference in New Issue
Block a user