Commit 1a4cd3f6 authored by Alexis SALZMAN's avatar Alexis SALZMAN

[XFEM] change API of LOCALVECTOR concept (xAssembler concept)

This commit pass from () to [] operator for LOCALVECTOR concept of
xAssembler concept. This is opening usage of assemble_vector method
to a wider range of container types. LOCALVECTOR may now be a
xCSRVector or a std::vector for example. xFemVector having both
operator remains functional (maybe () operator should be removed now ?).

Some comments are added to try to clarify LOCALVECTOR and LOCALMATRIX
concept.
parent 4727e73e
......@@ -27,7 +27,7 @@ namespace xfem
the following define the Assembler Concept. The function needed by the Assemble algorithm from xAlgorithm.h
Note that most member function are template, which prevent any of them to be virtual : No dynamic polymorphism allowed !
This way we can assemble any type of local data.
The only alternative to be able to do that was to use some kind of type earasure, for example by writting the interface in term od
The only alternative to be able to do that was to use some kind of type earasure, for example by writting the interface in term of
std::function <double (int, int) > to have a uniform signature whatever the type of local Matrix/ Vector ... The problem is that
then the access to a given term was taking too long, and no latter optimisation like block assembly for instance would be possible
......@@ -44,6 +44,16 @@ public:
void assemble_scalar(const LOCALSCALAR& scal);
void setCoeff(const double& c) { coeff = c; }
};
Here LOCALMATRIX concept must provides at least :
A parentheses operator that takes two integers and return the term associated to these arguments in the matrix
In one xAssembler (xAssemblerLumpedBlockEqu) two extra methods getNbRow() and getNbCol() are also required. To clarified this
concept we may consider these methods as mandatory ones, for all xAssembler. Or xAssemblerLumpedBlockEqu may be changed to avoid
use of getNbCol()
Here LOCALVECTOR concept must provides :
A [] operator that takes one integer and return the term associated to this argument in the vector
!*/
// Defining here the assemble methode give the possibility to optimize the loop on elementary matrix matr by just dispaching
......@@ -158,7 +168,7 @@ class xAssemblerBasic : public xAssemblerBaseData<M, V, S>
{
for (int i = 0; first != last; ++first, ++i)
{
auto val = vect(i) * this->coeff;
auto val = vect[i] * this->coeff;
if (val != xtool::xDataType<S>::zero())
xMatVecScaAssembler<M, V, S>::assemble((*first)->getState(), val, this->vec, this->sca);
}
......@@ -226,7 +236,7 @@ class xAssemblerBasicAndTranspose : public xAssemblerBaseData<M, V, S>
{
for (int i = 0; first != last; ++first, ++i)
{
S val = vect(i) * this->coeff;
S val = vect[i] * this->coeff;
if (val != xtool::xDataType<S>::zero())
xMatVecScaAssembler<M, V, S>::assemble((*first)->getState(), val, this->vec, this->sca);
}
......@@ -302,7 +312,7 @@ class xAssemblerLumped : public xAssemblerBaseData<M, V, S>
{
for (int i = 0; first != last; ++first, ++i)
{
S val = vect(i) * this->coeff;
S val = vect[i] * this->coeff;
if (val != xtool::xDataType<S>::zero())
xMatVecScaAssembler<M, V, S>::assemble((*first)->getState(), val, this->vec, this->sca);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment