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
Conversation
@metivett test_levelset.cpp doesn't compile. Could you fix asap? |
@vincentchabannes Done ! I also merged some fixes in the |
@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 |
I do not agree, the interface allows to support range, as you can see here. And it supports range of elements, faces, edges, points. It's hard to maintain another mpi code. |
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 ). |
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). |
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 ;-) ! |
|
I don't really agree, I just think the purposes are just a bit different : 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). |
For finish :)
I comment on this function because I need to review all mpi comm, there are some troubles with last boost (>=1.70) #1296 #1438. |
…lpp into feature/toolboxes-refactoring
…cess dofIds to prevent calls to searchGlobalProcessDof which is costly for ghost dofs)
…elpp/feelpp into feature/toolboxes-refactoring
…elpp/feelpp into feature/toolboxes-refactoring
…lpp into feature/toolboxes-refactoring
…on and conservativeFluxSource
…upling with gravity if enable (@lberti)
- 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
…f partial mesh support
There was a problem hiding this 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 ) |
There was a problem hiding this comment.
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 ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std::make_shared
There was a problem hiding this comment.
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) | ||
); | ||
} | ||
|
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 "; |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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() ) |
There was a problem hiding this comment.
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*/ ) |
There was a problem hiding this comment.
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*/ ) |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 ?
Update in feelpp-lib :
Major update in feelpp-toolboxes :
-- export math expressions from JSON
-- factorize code of post-processing in toolboxes
-- 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 )
-- new post-process measures : TO COMPLETE
-- no use a composite space for fluid/pressure
-- implement rigid particle bc
-- TO COMPLETE
-- 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