Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New grid implementation #51

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

New grid implementation #51

wants to merge 31 commits into from

Conversation

henrij22
Copy link
Collaborator

@henrij22 henrij22 commented Apr 23, 2024

This is of course not perfect, but most use cases should work without a problem

@henrij22 henrij22 self-assigned this Apr 23, 2024
@henrij22 henrij22 force-pushed the feature/workOnCreateLvl branch 2 times, most recently from 3580b50 to 7be4aec Compare April 30, 2024 11:55
@henrij22 henrij22 requested a review from rath3t April 30, 2024 13:39
Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 86.88397% with 338 lines in your changes missing coverage. Please review.

Project coverage is 87.96%. Comparing base (3b7f7f5) to head (fa0c719).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...rameterspace/default/trimmingutils/trimelement.inl 46.30% 80 Missing ⚠️
.../parameterspace/default/trimmingutils/cliputils.hh 70.07% 41 Missing ⚠️
dune/iga/io/vtk/igadatacollector.hh 69.47% 29 Missing ⚠️
dune/iga/geometrykernel/closestpointprojection.hh 72.72% 18 Missing ⚠️
dune/iga/parameterspace/default/trimelement.hh 78.75% 17 Missing ⚠️
...ntegrationrules/simplexintegrationrulegenerator.hh 0.00% 12 Missing ⚠️
...pace/default/trimmingutils/indextransformations.hh 67.56% 12 Missing ⚠️
...a/parameterspace/default/patchgridintersections.hh 86.58% 11 Missing ⚠️
.../parameterspace/default/trimmingutils/trimutils.hh 75.55% 11 Missing ⚠️
dune/iga/geometrykernel/nurbspatchgeometry.hh 86.66% 8 Missing ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   78.04%   87.96%   +9.92%     
==========================================
  Files          31       65      +34     
  Lines        3913     4181     +268     
==========================================
+ Hits         3054     3678     +624     
+ Misses        859      503     -356     
Flag Coverage Δ
tests 87.96% <86.88%> (+9.92%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

henrij22 and others added 9 commits June 18, 2024 15:54
add file

first working version

save

more things working

update

working

cleanup

second order derivative

more fixes

fixes

more tets

more working tests

refactor

more refactor

working

cleanup

some cleanup

all grid tests fwork

refactor basis

lots of refactorering

more refactoring for basis

running tests

refactor

fix clang format and tests

basis fixes

working untrimmed tests


fix format

fixes

add docs

add ref element

refactoring

compiling trim concepts

created trimmer interface

add json

refactor

more refactoring

more fixes

fixes

working intersection

refactor geometry localview

fixes

working default trimmer

cleanup

big cleanup

big refactor

more tests

add trimmer concept

docs

fixes

TODOS
fix

ref

small fixes

refactor

test

lots of refactor

now everything exploded

test

fixies

fixes

refactor types

working with subgrid

save state

fix

refactor intersections

intersections

more refactor

more fixing

fix

adding own idset

further steps forward

fixes

further progress

moar

fixes

fixes

wokring untrimmed case

refactor

call it a day

fixes

fix

fixes

refactor

refactor

Wip new z callback

Weekend

Forgot to push

Correct intersections for closed trimming boundaries
It wasn't correct the first time

Okay maybe not exactly what I wanted

new idea

Clipping should be fine now

Correct topology of trimmed elements

pre chrtimas

Intersectionspoints + findIntersectionLine with linear case

save

cplitCurve algo + enhancements of clipAlgo

dix clang fomat

save before refactor

Rework of IP - Algo

More examples are working

tidy up

New test

fix (add getters)

Add support for multiple IP per edge

z-Value handler in patchTrimData

save

fix format

support for vertices inside element

add several tests


save

Fixed some things + testcase for hole geometries

added good guess for line parameter

commented slice curve algo

support for hole geometries

yeah

fix and refactor linear curve and line algo

add testcase for worldim = 3 + fix in splitcurve

added multiplicity function

some tidy up + some bug fix

add isConnectedAtBoundary function to NurbsPatchGeometry class

small refactoring. Mainly adding curve and loop index encoder

refactor

more refactor

move isPointOnLine

add sampling info to clipper Z value

small fixes to fix tests

refactor vertex

frest vertex refactor

refactor isFullElement if statement


clang format and fix bug with full element on right corner


fix

work

Extract draw grid method

fix the tests

save

more work

work 3

gridtest work again

makecreatelvlbrokenagain

save

first tests are working
Intersection in progress

Intersection Variant einbau

intersections are working (at least a bit)

Intersections maybe working

all tests working except intersection


empty elements are working

all tests compiling?

run tests now

transform to span + integrationrules

VTK Writer reimplemented

basis is working (???)



more tests

add cmake + more tests

fix?

Add secondFundamentalForm

add getQuadratureRule
fix tests

minor work

Change namespace to IGA

work

work work

fix

fix?

transfer

add devcontainer

Rookie implementation of boundarySegmentIndex

idk

fix docker container for actions

work

fixes 1


is this needed? fixes 2


add generators for USINGZ fixes 3


fix from rebase

Work work

push to test pypi

fix

fix cmake

fix cmake again

fix3

fix5

fix7

fix9

fix cmake for the 100th time

cmake 101

cmake 102

cmake 103

cmake 104

cmake 105
fixing some bugs

Some fixies

add some test cases

add postKnotRefinement

Get rid of no unique address

some more test

add unstructured grid

mak integration rules a bit more efficient
fix

fix

fix

fix adaptive refinement & fix clang format

k refinement for basis

fix

fix2
refactor file structure

I did something wrong

cmake?

add benchmark + some refactoring

2

fixes

Refactor naming

a few more things

factory foctories and make basis fast again (100x improvement)
fixies and foxies

fix-clang-format

fix integration rule + spelling

fix

fix clang-format version

fix2

fix action action action

fix3

fix format & license

fix license and format again
@henrij22 henrij22 force-pushed the feature/workOnCreateLvl branch from 7bd6c22 to fdc6f2c Compare June 18, 2024 13:56
@henrij22 henrij22 changed the title Merge trimming capabilities New grid implementation Jun 18, 2024
using EdgeEntity = typename ParameterSpaceTraits::template Codim<1>::ParameterSpaceGridEntity;
using VertexEntity = typename ParameterSpaceTraits::template Codim<2>::ParameterSpaceGridEntity;

// auto& globalIdSetParameterSpace = parameterSpaceGrid_->globalIdSet();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed


metadata = metaData(duneVersion)[1]
metadata["version"] = duneigaVersion

metadata["name"] = "dune-iga-experimental"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed? This is the python package name at the end isnt it?

// template<typename Curve>
// auto windingNumberOfCurve(const Curve& curve, const Dune::FieldVector<double,2>&
// p=Dune::FieldVector<double,2>{0.5,0.5}) {
//
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want you can also celanup here and below

// if(re.checkInside({x,y}))
// ++insideCounter;
//
// if(samples>=minsamples and oldRatio>0 and
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

const int oldLevel = untrimmedParameterSpaceGrid_->maxLevel();
untrimmedParameterSpaceGrid_->globalRefine(refCount);

// parameterSpaceGrid_->insertLeaf();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

template <int codim>
using Entity = typename ParameterSpace::ParameterSpaceTraits::template Codim<codim>::ParameterSpaceGridEntity;
// template <int codim>
// using EntityMap = std::map<IdType, ElementEntity<codim>>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too


// Compute individual hash values for first, second and third and combine them using XOR
// and bit shifting:
// todo
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

auto index() const {
// TODO
// if constexpr (codim_ == 0)
// return isTrimmed() ? entityInfo_.trimmedIndexInLvl : entityInfo_.unTrimmedIndexInLvl;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

@param level grid level on which the iterator shall be created
*/
// template<typename =void> requires (codim!=0)
// explicit PatchGridLevelIterator(const GridImp* patchGrid, int level, [[maybe_unused]] bool endDummy)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

using IteratorImplR = typename GridImp::ParameterSpace::template ParameterSpaceLevelIterator<codim, pitype>;
using OLDIteratorImpl =
typename GridImp::ParameterSpaceGrid::template Codim<codim>::template Partition<pitype>::LevelIterator;
using IteratorImpl = IteratorImplR; // std::conditional_t<codim==0,IteratorImplR,OLDIteratorImpl>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

[[maybe_unused]] bool endDummy)
: parameterSpaceGrid_(parameterSpaceGrid),
maxLevel_{maxLevel}
// , hostHierarchicIterator_(startEntity.impl().getHostEntity().hend(maxLevel)),maxLevel_{maxLevel}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

setCurrentEntity(); // since std::stack is LIFO, we set the current entity to the first son of the old son

// ++hostHierarchicIterator_;
// ++descendantLocalIndex_;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF)

set(THREADS_PREFER_PTHREAD_FLAG ON)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need that?

// auto subEntityName = [](std::size_t codim)-> std::string {
// return codim==0 ? "element" : codim==1 ? "edges" : "vertices" ;
// };
// std::cout<<"The size of "<<subEntityName(cc)<<" with codim "<<cc<<" of the "<<i<<"-th
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

// auto subEntityName = [](std::size_t codim)-> std::string {
// return codim==0 ? "element" : codim==1 ? "edges" : "vertex" ;
// };
// std::cout<<"The index of the "<<ii<<"-th "<<subEntityName(cc)<<" with codim "<<cc<<" of the "<<i<<"-th
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

auto subEntities(int i, int c, int cc) const {
// auto subEntityName = [](std::size_t codim)-> std::string {
// return codim==0 ? "element" : codim==1 ? "edges" : "vertices" ;
// };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

// TODO this functions could be a bit complicated basically we have to make sure the point lies inside the
// outer boundary loop, but outside the inner loops thus we have to implement something as
//
https://en.wikipedia.org/wiki/Point_in_polygon#:~:text=One%20simple%20way%20of%20finding,an%20even%20number%20of%20times.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

typename Codim<codim>::Geometry geometry(int i) const {
// TODO trim returns the reference element in geometry space
// return _impl->template geometry<codim>(i);
// if constexpr (codim==0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

// Returns true if the point is in the current element
// TODO
bool checkInside(const LocalCoordinate& local) const {
return true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here?


// TODO
[[nodiscard]] Volume integrationElement(const LocalCoordinate& local) const {
return hostGeometry_.volume();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here?

for (const auto& pt : resultClosedPaths.front()) {
if (auto [isHost, idx] = isCornerVertex(pt, eleRect); isHost)
result.addOriginalVertex(idx);
// result.addOriginalVertex(idx, pt.z > 4 ? std::optional<size_t>(pt.z) : std::nullopt);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

result.finish(patchTrimData);

// While developing
// result.report();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

TrimmedParameterSpaceGridEntity& operator=(TrimmedParameterSpaceGridEntity&& other) noexcept = default;

// TODO tidy up these constructors
// Entity with codim 0 but trimmed thus needs trimdata
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

requires(codim_ == 0)
[[nodiscard]] decltype(auto) ilevelbegin() const {
// if(trimData_)
// return trimData_.template ilevelbegin<codim_>(localId_);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this return is wrong I suppose? Here a notimplemented would better?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also methods below

// clang-format on
// using GlobalIdSetType = PatchGridGlobalIdSet<const Grid>;

// template <int codim, PartitionIteratorType pitype>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here


// get number of entities of given codim, type and on this level
std::size_t size(GeometryType type) const {
// TODO Trim, count cube and none types i.e. full and trimmed elements
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here


/** @brief Deliver all geometry types used in this grid */
Types types(int codim) const {
// TODO Trim, this should return none and cube for trimmed geometries
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also this should be removed


using LocalCoordinate = std::common_type_t<typename Implementations::LocalCoordinate...>;
using GlobalCoordinate = std::common_type_t<typename Implementations::GlobalCoordinate...>;
// using JacobianTransposed = std::common_type_t<typename Implementations::JacobianTransposed...>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

Copy link
Owner

@rath3t rath3t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok let get this finished. I marked several places, where I saw commented code that should be removed or coutdated comments or code that is wrong and wher we should at least throw a NotImplemented. Furthermore, there are several TODOS that are still valid our outdated. can you search for them and add some comments why it is there or if it is outdated removed it.

You can resolve all my comments and then we can merge this. thanks!

@rath3t
Copy link
Owner

rath3t commented Feb 26, 2025

Ah yes and please rebase on master, because there are conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants