pyccel / psydac

Python 3 library for isogeometric analysis
https://pyccel.github.io/psydac/
MIT License
47 stars 17 forks source link

New Mapping hierarchy #429

Open Sworzzy opened 1 week ago

Sworzzy commented 1 week ago

This PR is to link with Sympde PR#168, where the new hierarchy is showed.

The interface is now simpler. An example can be in the files changed of this PR, in psydac/api/postprocessing.py, in the _get_mesh function l. 2286 : There is no callable mapping anymore. So the type of the mapping now is either : spline, analytic or None. ANd you may do directly evaluations on the object without getting a callable argument or so.

This new hierarchy maintains "domain undefined mapping", that you may get from the Domain.from_file method. Now, in the tests, the real mappings (the "defined" or "callable" version), can be obtained from domain_h.mappings (returns a list of mappings, either spline or analytic) : see psydac.api.tests.test_api_feec_2d.py

An improvement could be done in this mapping encapsulation. Which class should have the "defined" mapping, to have the most user-friendly tests. For example in psydac.api.tests.test_api_feec_2d.py, you must set the mapping attribute, of the derham object :

if use_spline_mapping:
        domain_h = discretize(domain, filename=filename, comm=MPI.COMM_WORLD) 
        derham_h = discretize(derham, domain_h, multiplicity = [mult, mult])

        # TO FIX : the way domain.from_file and discretize_domain runs make that only domain_h.domain.interior has an actual 
         SplineMapping. The rest are BaseMapping.
        # The trick is to now when to set exactly the BaseMapping to the SplineMapping. We could try in discretize_derham, but 
        see if it doesn't generate any issues for other tests.

        mappings=list(domain_h.mappings.values())

        if(len(mappings)>1):
            raise TypeError("we are not doing multipatch here")

        mapping = mappings[0] # mapping is SplineMapping now
        derham_h.mapping=mapping
Sworzzy commented 1 week ago

I've deleted all the .DS_Store files and modified the .gitignore suscessfully.