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

Feature/toolboxes refactoring #1416

Merged
merged 559 commits into from Jul 3, 2020
Merged

Feature/toolboxes refactoring #1416

merged 559 commits into from Jul 3, 2020

Conversation

vincentchabannes
Copy link
Member

@vincentchabannes vincentchabannes commented Jan 23, 2020

  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes?
  • Have you successfully run the Feel++ testsuite with your changes locally?
  • Have you written Doxygen comments in your contribution ?

Update in feelpp-lib :

  • operatorinterpolation : Support interpolation operator with expression #1417
  • feelvf : Merge GinacExVf and GinacMatrix #1475
  • feelvf : symbolic expression can depend on an expression which can depend on another expresssions etc..
  • feelvf : support differentiation of expression with respect to a symbol name
  • feelvf : refactoring of mat/vec keywords, replace boost::fusion by boost::hana.
  • feelmodels : refactoring of ModelParameters (not only constant parameter)
  • feells : TO COMPLETE

Major update in feelpp-toolboxes :

  • core : new definition of toolbox thanks to ModelFields and ModelPhysics class. Factorize and simplify the definition of symbol and the genration of materials properties
  • post-processing update :
    -- export math expressions from JSON
    -- factorize code of post-processing in toolboxes
  • material properties:
    -- unique material properties share by mono/multiphysics toolboxes
    -- generate automatically all symbol expressions
    -- create a keyword that allows defining a material property for all materials (the expression is selected from the context, .i.e. the mesh element )
  • heat toolbox :
    -- new post-process measures : TO COMPLETE
  • fluid toolbox :
    -- no use a composite space for fluid/pressure
    -- implement rigid particle bc
  • levelset/multifluid :
    -- TO COMPLETE
  • coefficient form pdes (new toolbox) :
    -- a pde or a system of pdes can be solved by given the coefficients: m d^2 u/dt^2 + d du/dt + \nabla \cdot ( -c \nabla u ) + \beta cdot \nabla u + a u = f where m, d, c, \beta, a, f are the coefficients.
    -- the type of finite element used in each equation can be differents

@vincentchabannes
Copy link
Member Author

@metivett test_levelset.cpp doesn't compile. Could you fix asap?

@metivett
Copy link
Member

test_levelset.cpp doesn't compile. Could you fix asap?

@vincentchabannes Done ! I also merged some fixes in the MultiFluid toolbox from the feature/ls branch.
I am working on updating all the testcases (only multifluid_square is done at the moment).

@vincentchabannes
Copy link
Member Author

vincentchabannes commented Mar 4, 2020

@metivett what is the goal of syncDofs (feelpp/feel/feeldiscr/syncdofs.hpp).
We have already the sync keyword which seems to do the same thing I think, no? see #671 . And I have added also the close args with on(..) projection which can apply easily the sync.

@metivett
Copy link
Member

metivett commented Mar 4, 2020

@metivett what is the goal of syncDofs (feelpp/feel/feeldiscr/syncdofs.hpp).
We have already the sync keyword which seems to do the same thing I think, no? see #671 . And I have added also the close args with on(..) projection which can apply easily the sync.

@vincentchabannes Actually the goal was to allow a simpler interface (using only a lambda function instead of a functor derived from SyncOp), and to enable the synchronisation of a restricted set of dofs specified by an element range (and not a set of dofs). We could extend the sync function to provide these functionalities for sure, but I did not want to break other codes...

@vincentchabannes
Copy link
Member Author

vincentchabannes commented Mar 4, 2020

I do not agree, the interface allows to support range, as you can see here.
And the options with ComponentType::NO_COMPONENT and the boolean are optionally(optimization)

And it supports range of elements, faces, edges, points.

It's hard to maintain another mpi code.

@metivett
Copy link
Member

metivett commented Mar 4, 2020

Ok, but the functor approach is a bit cumbersome I think, and the syncDofs function is more generic than the sync one since it allows to synchronise any template vector (the vector and datamap types are separate parameters, see eg here ).

@vincentchabannes
Copy link
Member Author

There is some optimisation for the classic case ( =) and I treat only the dofs on interprocess, this is not the case with your implementation (some loop over all range).
we can add easily an interface for your case.

@metivett
Copy link
Member

metivett commented Mar 4, 2020

I don't really see what you can optimise further, at some point you need to find the interprocess dofs which are in your range (in my case it is done in the function while you do it separately with the functionspace->dofs() call). But if you want we can merge the two functions ;-) !

@vincentchabannes
Copy link
Member Author

vincentchabannes commented Mar 4, 2020

  1. I doesn't call localToGlobal and this has a cost (you do this for all element)
  2. The dofs at interprocess are identified only one time, we can reuse it after for each sync
  3. In the case of = operator, we don't need to apply 2 passes of mpi communication, but only one.

@metivett
Copy link
Member

metivett commented Mar 4, 2020

I don't really agree, I just think the purposes are just a bit different :
1 -> if you don't call localToGlobal, then you need to send all the ghost interprocess dofs, not just the one which are in your range, which can lead to unneeded communications
2 -> the dofs which are both interprocess and in your range can't be reused (the range changes)
3 -> ok, but I had a generic lambda synchronisation in mind

But I will not fight to death for my function ;-), as I said we can refactor the sync one to enable my use (and maybe the flexibility of lambdas).

@vincentchabannes
Copy link
Member Author

For finish :)

  1. No, the informations are in DataMap. but you need to communicate if the range is not contains the active dofs. Try with a random partitioning
  2. Maybe in your case, but generally no.

I comment on this function because I need to review all mpi comm, there are some troubles with last boost (>=1.70) #1296 #1438.

vincentchabannes and others added 28 commits June 18, 2020 15:23
- can pass a mesh support instead of a mesh : allow to force some elements extracted (that are isolated in mesh support) to be ghost (can fix some special case of partitioning)
- up mpi comm for #1296
Copy link
Member

@prudhomm prudhomm left a comment

Choose a reason for hiding this comment

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

I lost all the comments I made.
about 40 of them. I approve the PR

@@ -362,6 +362,12 @@ class FEELPP_EXPORT Backend : public BackendBase, public std::enable_shared_from

virtual sparse_matrix_ptrtype newZeroMatrix( datamap_ptrtype const& dm1, datamap_ptrtype const& dm2 ) = 0;

virtual sparse_matrix_ptrtype newIdentityMatrix( datamap_ptrtype const& dm1, datamap_ptrtype const& dm2 )
Copy link
Member

Choose a reason for hiding this comment

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

why not a pure virtual like above ?

@@ -294,6 +294,18 @@ class FEELPP_EXPORT BackendPetsc : public Backend<T,SizeT>
return mat;
}

sparse_matrix_ptrtype newIdentityMatrix( datamap_ptrtype const& domainmap, datamap_ptrtype const& imagemap )
{
graph_ptrtype sparsity_graph( new graph_type( imagemap,imagemap ) );
Copy link
Member

Choose a reason for hiding this comment

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

use std::make_shared

Copy link
Member

Choose a reason for hiding this comment

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

it is slightly less expensive, only one heap allocation

static_cast<F&&>(f), static_cast<ItT1&&>(itBegin), static_cast<ItT2&&>(itEnd)
);
}

Copy link
Member

Choose a reason for hiding this comment

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

@metivett could you add some basic documentation ala doxygen ?


} // namespace detail

template <typename F, typename ItT1, typename ItT2>
Copy link
Member

Choose a reason for hiding this comment

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

@metivett could you add some basic documentation ala doxygen ?

break;
}
}
CHECK( find ) << "not find a compatible dof\n ";
Copy link
Member

Choose a reason for hiding this comment

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

better wording "a compatible dof was not found between image and domain dof" ?

{
auto const& theexpr = std::get<1>( e );
Copy link
Member

Choose a reason for hiding this comment

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

would it be possible to wrap the tuple into a class or struct with a more explicit interface ?
if it stays private and is not exposed, this is not necessary

bool hasAtLeastOneSymbolDependency( AnElementOfSymbolExprType const& e ) const
{
bool res = false;
if ( std::get<2>( e ).empty() )
Copy link
Member

Choose a reason for hiding this comment

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

same as above

@@ -877,11 +1018,18 @@ public :

template <typename ExprT>
Expr<ExprT>
expr( ExprT const& exprt )
expr( ExprT const& exprt, typename std::enable_if_t<is_vf_expr_v<ExprT> >* /*= nullptr*/ )
Copy link
Member

Choose a reason for hiding this comment

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

why no default value ?
you could also have this in the template rather than the argument of the function. that would (de)select earlier in the compilation process the function

{
return Expr<ExprT>( exprt );
}

template <typename ExprT>
Expr<ExprT>
expr( ExprT && exprt, typename std::enable_if_t<is_vf_expr_v<ExprT> >* /*= nullptr*/ )
Copy link
Member

Choose a reason for hiding this comment

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

idem

} \
\
template <typename TheSymbolExprType> \
bool hasSymbolDependency( std::string const& symb, TheSymbolExprType const& se ) const \
Copy link
Member

Choose a reason for hiding this comment

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

how about testing nx, ny nz symbols ?

Copy link
Member

Choose a reason for hiding this comment

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

or is it not relevant ?

@prudhomm prudhomm merged commit 27aa80d into develop Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants