Commit 953b8f8d authored by Alexis SALZMAN's avatar Alexis SALZMAN

Xfiles] miscellaneous change related to warnings

Changes are:
  * unused variable
  * wrong order for explicit member creation
  * wrong sign comparison
  * change int to size_t
  * virtual destructor addition to avoid in future a possible memory leek
parent c04103bc
This diff is collapsed.
......@@ -69,7 +69,7 @@ void xApproxFunctionBySupportComponentGenerator::generateKeysAndFcts(AOMD::mEnti
for (size_t i = 0; i < fctsnew.size(); ++i)
{
fcts->push_back(approxFctPtr_t(new xApproxFunctionEnrichedXFEM(f, fctsnew[i])));
sprintf(buffer, "%lu\0", i);
sprintf(buffer, "%zu\0", i);
key_modifier->addToExtension(std::string(buffer));
(*key_modifier)(key);
keys->push_back(key);
......@@ -82,9 +82,9 @@ void xApproxFunctionBySupportComponentGenerator::generateKeys(xfem::xValKey &key
femFcts_t fctsnew;
getEnrichmentFunctions(e_enriched, fctsnew);
char buffer[256];
for (int i = 0; i < fctsnew.size(); ++i)
for (size_t i = 0; i < fctsnew.size(); ++i)
{
sprintf(buffer, "%lu\0", i);
sprintf(buffer, "%zu\0", i);
key_modifier->addToExtension(std::string(buffer));
(*key_modifier)(key);
keys->push_back(key);
......
/*
/*
This file is a part of eXlibris C++ Library
under the GNU Lesser General Public License.
See the NOTICE.md & LICENSE.md files for terms
See the NOTICE.md & LICENSE.md files for terms
and conditions.
*/
......@@ -9,57 +9,67 @@
#define __SPACEFACTORY_H
#include <string>
#include "xSpace.h"
#include "xSpacePolynomial.h"
#include "xSpacePolynomialQH.h"
namespace xfem
{
class xNonLocalInfoGeneratorForKeysAndFcts;
class xNonLocalInfoGeneratorForKeysAndFcts;
class xSpaceFactoryBase
{
public:
enum space_product_tensorial_type { SCALAR, V1Dx, V1Dy, V1Dz, V2Dxy, V2Dxz, V2Dyz, V3D };
void setSpaceProductOrder(const int order_);
void setSpaceProductPhysStrings(std::vector<std::string> & phys_strings_ );
void setSpaceProductGenerator(xNonLocalInfoGeneratorForKeysAndFcts * generator);
const std::string & getPhysString( unsigned int id) const;
virtual xSpace::spacePtr getSpace()=0;
virtual xSpace::spacePtr getSpace(std::string s)=0;
protected:
template <typename SPACE >
SPACE createSpaceProduct(std::string &phys ,xSpace::TensorialType_t space_tensorial);
xSpaceLagrange::lag_degree_t getHierachicalOrder();
void setPhysString(std::string s1);
void forceSetPhysString(std::string & s1);
void setPhysString(std::string s1,std::string s2);
void setPhysString(std::string s1,std::string s2, std::string s3);
void error1();
xNonLocalInfoGeneratorForKeysAndFcts * generator;
std::vector<std::string> phys_strings;
int order;
public:
enum space_product_tensorial_type
{
SCALAR,
V1Dx,
V1Dy,
V1Dz,
V2Dxy,
V2Dxz,
V2Dyz,
V3D
};
void setSpaceProductOrder(const int order_);
void setSpaceProductPhysStrings(std::vector<std::string> &phys_strings_);
void setSpaceProductGenerator(xNonLocalInfoGeneratorForKeysAndFcts *generator);
const std::string &getPhysString(unsigned int id) const;
virtual ~xSpaceFactoryBase() = default;
virtual xSpace::spacePtr getSpace() = 0;
virtual xSpace::spacePtr getSpace(std::string s) = 0;
protected:
template <typename SPACE>
SPACE createSpaceProduct(std::string &phys, xSpace::TensorialType_t space_tensorial);
xSpaceLagrange::lag_degree_t getHierachicalOrder();
void setPhysString(std::string s1);
void forceSetPhysString(std::string &s1);
void setPhysString(std::string s1, std::string s2);
void setPhysString(std::string s1, std::string s2, std::string s3);
void error1();
xNonLocalInfoGeneratorForKeysAndFcts *generator;
std::vector<std::string> phys_strings;
int order;
};
template <typename SPACE, xSpaceFactoryBase::space_product_tensorial_type TT>
class xSpaceFactory : public xSpaceFactoryBase
{
public:
xSpaceFactory();
xSpace::spacePtr getSpace() override;
xSpace::spacePtr getSpace(std::string s) override;
private:
public:
xSpaceFactory();
xSpace::spacePtr getSpace() override;
xSpace::spacePtr getSpace(std::string s) override;
private:
};
} // end of namespace
} // namespace xfem
#include "xSpaceFactory_imp.h"
......
......@@ -336,7 +336,7 @@ xVertex aomdMeshQueryInterface::getMeshVertexFromId(int ID) const { return xVert
void aomdMeshQueryInterface::translateToPartitionManagerXentity(xPartitionManagerXentity& part_man_XENT,
const partmanAOMD_t& part_man_AOMD)
{
MPI_Comm _comm = part_man_AOMD.getComm();
// MPI_Comm _comm = part_man_AOMD.getComm();
// the new partition manager (to be return)
// xPartitionManagerXentity part_man_XENT(*this, _comm);
......
This diff is collapsed.
#ifndef _XPARTITIONMANAGERXENTITY_H
#define _XPARTITIONMANAGERXENTITY_H
#include "xEntity.h"
#include "xEntityHashKey.h"
#include "xPartitionManager.h"
#include "xGeneralUnorderedMapDataManager.h"
#include "xPartitionManager.h"
namespace xinterface{
namespace xmeshinterface{
// cas particulier pour xEntity : la map est gérée par xEntity, mais on stocke uniquement une void* correspondant à la UniqueAdDress de xEntity. Ceci se fait avec la fonction insertUntyped(...) du partitionObject (po).
template < class DATATYPE >
using DataManagerXentity = xtool::xGeneralUnorderedMapDataManager<xEntity, DATATYPE, xEntityHashKey, xEntityEqualKey >;
//--------------------------------------------------------------------------
// classe de base
//--------------------------------------------------------------------------
class xPartitionManagerXentityBase : public xtool::xPartitionManager< DataManagerXentity > {
public:
xPartitionManagerXentityBase(MPI_Comm _comm = MPI_COMM_WORLD) : xPartitionManager(_comm){};
~xPartitionManagerXentityBase() =default;
virtual xEntity getXentityFromUniqueAddressAndQueryTag( const void* address, unsigned int tag ) const =0;
virtual void print() const =0 ;
inline MPI_Comm getComm() const { return comm;};
};
class xPartitionManagerXentityUnion;
//--------------------------------------------------------------------------
// classe d'un partition_manager construit à partir d'une query
//--------------------------------------------------------------------------
class xPartitionManagerXentity : public xPartitionManagerXentityBase {
public:
xPartitionManagerXentity(const xMeshQueryInterface& _query, MPI_Comm _comm= MPI_COMM_WORLD): query(_query), xPartitionManagerXentityBase(_comm) {};
~xPartitionManagerXentity()=default;
xEntity getXentityFromUniqueAddressAndQueryTag( const void* address, unsigned int tag ) const;
inline const xMeshQueryInterface& getQuery() const {return query; };
void print() const;
protected:
// case of simple partition_manager (not union), query is needed but
xEntity getXentityFromUniqueAddress ( const void* address ) const;
friend xPartitionManagerXentityUnion;
private:
const xMeshQueryInterface& query;
};
//----------------------------------------------------------------------------------
// classe d'un partition_manager construit à partir d'une union de plusieurs query :
//----------------------------------------------------------------------------------
// => utile pour un DOF manager s'appuyant sur plusieurs queries/maillages
// xPartitionManagerXentityUnion----------------------------
class xPartitionManagerXentityUnion : public xPartitionManagerXentityBase {
private:
std::vector<const xPartitionManagerXentity*> partman_container;
public:
xPartitionManagerXentityUnion(MPI_Comm _comm= MPI_COMM_WORLD) : xPartitionManagerXentityBase( _comm) {};
~xPartitionManagerXentityUnion() ;
void add(const xPartitionManagerXentity& new_element);
const xtool::xConstPartitionObject < xEntity > getConstPartitionObject(xEntity& enti) const;
xEntity getXentityFromUniqueAddressAndQueryTag( const void* address , unsigned int tag) const;
void print() const;
};
} // namespace xmeshinterface
} // namespace xinterface
namespace xinterface
{
namespace xmeshinterface
{
// cas particulier pour xEntity : la map est gérée par xEntity, mais on stocke uniquement une void* correspondant à la
// UniqueAdDress de xEntity. Ceci se fait avec la fonction insertUntyped(...) du partitionObject (po).
template <class DATATYPE>
using DataManagerXentity = xtool::xGeneralUnorderedMapDataManager<xEntity, DATATYPE, xEntityHashKey, xEntityEqualKey>;
//--------------------------------------------------------------------------
// classe de base
//--------------------------------------------------------------------------
class xPartitionManagerXentityBase : public xtool::xPartitionManager<DataManagerXentity>
{
public:
xPartitionManagerXentityBase(MPI_Comm _comm = MPI_COMM_WORLD) : xPartitionManager(_comm){};
~xPartitionManagerXentityBase() = default;
virtual xEntity getXentityFromUniqueAddressAndQueryTag(const void* address, unsigned int tag) const = 0;
virtual void print() const = 0;
inline MPI_Comm getComm() const { return comm; };
};
class xPartitionManagerXentityUnion;
//--------------------------------------------------------------------------
// classe d'un partition_manager construit à partir d'une query
//--------------------------------------------------------------------------
class xPartitionManagerXentity : public xPartitionManagerXentityBase
{
public:
xPartitionManagerXentity(const xMeshQueryInterface& _query, MPI_Comm _comm = MPI_COMM_WORLD)
: xPartitionManagerXentityBase(_comm), query(_query){};
~xPartitionManagerXentity() = default;
xEntity getXentityFromUniqueAddressAndQueryTag(const void* address, unsigned int tag) const;
inline const xMeshQueryInterface& getQuery() const { return query; };
void print() const;
protected:
// case of simple partition_manager (not union), query is needed but
xEntity getXentityFromUniqueAddress(const void* address) const;
friend xPartitionManagerXentityUnion;
private:
const xMeshQueryInterface& query;
};
//----------------------------------------------------------------------------------
// classe d'un partition_manager construit à partir d'une union de plusieurs query :
//----------------------------------------------------------------------------------
// => utile pour un DOF manager s'appuyant sur plusieurs queries/maillages
// xPartitionManagerXentityUnion----------------------------
class xPartitionManagerXentityUnion : public xPartitionManagerXentityBase
{
private:
std::vector<const xPartitionManagerXentity*> partman_container;
public:
xPartitionManagerXentityUnion(MPI_Comm _comm = MPI_COMM_WORLD) : xPartitionManagerXentityBase(_comm){};
~xPartitionManagerXentityUnion();
void add(const xPartitionManagerXentity& new_element);
const xtool::xConstPartitionObject<xEntity> getConstPartitionObject(xEntity& enti) const;
xEntity getXentityFromUniqueAddressAndQueryTag(const void* address, unsigned int tag) const;
void print() const;
};
} // namespace xmeshinterface
} // namespace xinterface
#endif
......@@ -5,8 +5,10 @@
*/
#include "InterfaceOctreeToAOMD.h"
#include <algorithm>
#include <functional>
#include "mEdge.h"
#include "mFace.h"
#include "mTet.h"
......@@ -71,7 +73,6 @@ void OctreeToAOMDNoHangingProjection(const oOctree& octree, const oField& lsoct,
void InterfaceAOMDToOctree(const xMesh& mesh, const xLevelSet& ls, oField& lsoct)
{
xMesh& mesh_ = const_cast<xMesh&>(mesh);
const oKeyManager& key_manager = lsoct.getKeyManager();
for (oKey* key : key_manager)
{
......
This diff is collapsed.
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