Skip to content

Commit

Permalink
Work
Browse files Browse the repository at this point in the history
  • Loading branch information
henrij22 committed Apr 23, 2024
1 parent 83f63eb commit b038100
Show file tree
Hide file tree
Showing 36 changed files with 397 additions and 736 deletions.
5 changes: 2 additions & 3 deletions dune/iga/hierarchicpatch/patchgrid.hh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:

#pragma once

/** \file
Expand Down Expand Up @@ -479,7 +478,7 @@ public:
requires(GridFamily::template hasHostEntity<codim>)
const typename GridFamily::TrimmerTraits::template Codim<codim>::ParameterSpaceGridEntity& getHostEntity(
const typename Traits::template Codim<codim>::Entity& e) const {
return e.impl().getHostEntity();
return e.impl().getLocalEntity();
}

auto untrimmedElementNumbers(int lvl) const {
Expand Down
76 changes: 34 additions & 42 deletions dune/iga/hierarchicpatch/patchgridentity.hh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:

#pragma once

/** \file
Expand Down Expand Up @@ -77,48 +76,48 @@ public:
}

PatchGridEntity(const GridImp* patchGrid, const ParameterSpaceGridEntity& hostEntity)
: hostEntity_(hostEntity),
: localEntity_(hostEntity),
patchGrid_(patchGrid) {
}

PatchGridEntity(const GridImp* patchGrid, ParameterSpaceGridEntity&& hostEntity)
: hostEntity_(std::move(hostEntity)),
: localEntity_(std::move(hostEntity)),
patchGrid_(patchGrid) {
}

PatchGridEntity(const PatchGridEntity& original)
: hostEntity_(original.hostEntity_),
: localEntity_(original.localEntity_),
patchGrid_(original.patchGrid_) {
}

PatchGridEntity(PatchGridEntity&& original) noexcept
: hostEntity_(std::move(original.hostEntity_)),
: localEntity_(std::move(original.localEntity_)),
patchGrid_(original.patchGrid_) {
}

PatchGridEntity& operator=(const PatchGridEntity& original) {
if (this != &original) {
patchGrid_ = original.patchGrid_;
hostEntity_ = original.hostEntity_;
localEntity_ = original.localEntity_;
}
return *this;
}

PatchGridEntity& operator=(PatchGridEntity&& original) noexcept {
if (this != &original) {
patchGrid_ = original.patchGrid_;
hostEntity_ = std::move(original.hostEntity_);
localEntity_ = std::move(original.localEntity_);
}
return *this;
}

bool equals(const PatchGridEntity& other) const {
return getHostEntity() == other.getHostEntity();
return getLocalEntity() == other.getLocalEntity();
}

//! returns true if father entity exists
bool hasFather() const {
return hostEntity_.hasFather();
return localEntity_.hasFather();
}

//! Create EntitySeed
Expand All @@ -128,39 +127,38 @@ public:

//! level of this element
int level() const {
return hostEntity_.level();
return localEntity_.level();
}

/** @brief The partition type for parallel computing
*/
PartitionType partitionType() const {
return hostEntity_.partitionType();
return localEntity_.partitionType();
}

/** @brief Return the number of subEntities of codimension codim.
*/
unsigned int subEntities(unsigned int cc) const {
return hostEntity_.subEntities(cc);
return localEntity_.subEntities(cc);
}

// using ParameterSpaceGeometry = typename Trimmer::template LocalParameterSpaceGeometry<codim>;

//! geometry of this entity
Geometry geometry() const {
auto geo = typename Geometry::Implementation(
hostEntity_.geometry(), patchGrid_->patchGeometries_[this->level()].template localView<codim, Trimmer>());
localEntity_.geometry(), patchGrid_->patchGeometries_[this->level()].template localView<codim, Trimmer>());
return Geometry(geo);
}

const auto& getHostEntity() const {
return hostEntity_;
const auto& getLocalEntity() const {
return localEntity_;
}

bool isTrimmed() const {
return localEntity_.entityInfo_.trimmed;
}

// const auto& getHostEntity()const {
// return hostEntity_;
// }
private:
ParameterSpaceGridEntity hostEntity_;
ParameterSpaceGridEntity localEntity_;
const GridImp* patchGrid_;
};

Expand Down Expand Up @@ -226,33 +224,33 @@ public:
}

PatchGridEntity(const PatchGridEntity& original)
: localEntity_(original.hostEntity_),
: localEntity_(original.localEntity_),
patchGrid_(original.patchGrid_) {
}

PatchGridEntity(PatchGridEntity&& original) noexcept
: localEntity_(std::move(original.hostEntity_)),
: localEntity_(std::move(original.localEntity_)),
patchGrid_(original.patchGrid_) {
}

PatchGridEntity& operator=(const PatchGridEntity& original) {
if (this != &original) {
patchGrid_ = original.patchGrid_;
localEntity_ = original.hostEntity_;
localEntity_ = original.localEntity_;
}
return *this;
}

PatchGridEntity& operator=(PatchGridEntity&& original) noexcept {
if (this != &original) {
patchGrid_ = original.patchGrid_;
localEntity_ = std::move(original.hostEntity_);
localEntity_ = std::move(original.localEntity_);
}
return *this;
}

[[nodiscard]] bool equals(const PatchGridEntity& other) const {
return localEntity_ == other.hostEntity_;
return localEntity_ == other.localEntity_;
}

//! returns true if father entity exists
Expand All @@ -267,12 +265,12 @@ public:

//! Level of this element
[[nodiscard]] int level() const {
return getHostEntity().level();
return getLocalEntity().level();
}

/** @brief The partition type for parallel computing */
[[nodiscard]] PartitionType partitionType() const {
return getHostEntity().partitionType();
return getLocalEntity().partitionType();
}

//! Geometry of this entity
Expand Down Expand Up @@ -322,13 +320,13 @@ public:

//! returns true if Entity has NO children
bool isLeaf() const {
return getHostEntity().isLeaf();
return localEntity_.isLeaf();
}

//! Inter-level access to father element on coarser grid.
//! Assumes that meshes are nested.
typename GridImp::template Codim<0>::Entity father() const {
return PatchGridEntity(patchGrid_, getHostEntity().father());
return PatchGridEntity(patchGrid_, localEntity_.father());
}

/** @brief Location of this element relative to the reference element element of the father.
Expand Down Expand Up @@ -372,21 +370,15 @@ public:
return true;
}

bool isTrimmed() const {
return localEntity_.isTrimmed();
}

auto trimData() const {
return patchGrid_->trimData(*this);
}

// /////////////////////////////////////////
// Internal stuff
// /////////////////////////////////////////

// const auto& getHostEntity()const {
// if constexpr (requires {hostEntity_.untrimmedHostEntity();})
// return hostEntity_.untrimmedHostEntity();
// else
// return hostEntity_;
// }
const auto& getHostEntity() const {
const auto& getLocalEntity() const {
return localEntity_;
}

Expand Down
3 changes: 1 addition & 2 deletions dune/iga/hierarchicpatch/patchgridgeometry.hh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:

#pragma once

/** \file
Expand Down
Loading

0 comments on commit b038100

Please sign in to comment.