-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #912 from arcaneframework/dev/gg-begin-cartesianme…
…sh-coarsening Begin development for coarsening of cartesian mesh
- Loading branch information
Showing
10 changed files
with
252 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
arcane/ceapart/src/arcane/cartesianmesh/CartesianMeshCoarsening.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*- | ||
//----------------------------------------------------------------------------- | ||
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
//----------------------------------------------------------------------------- | ||
/*---------------------------------------------------------------------------*/ | ||
/* CartesianMeshCoarsening.cc (C) 2000-2023 */ | ||
/* */ | ||
/* Déraffinement d'un maillage cartésien. */ | ||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
#include "arcane/cartesianmesh/CartesianMeshCoarsening.h" | ||
|
||
#include "arcane/utils/FatalErrorException.h" | ||
|
||
#include "arcane/core/IMesh.h" | ||
#include "arcane/core/IParallelMng.h" | ||
|
||
#include "arcane/cartesianmesh/ICartesianMesh.h" | ||
#include "arcane/cartesianmesh/CellDirectionMng.h" | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
namespace Arcane | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
CartesianMeshCoarsening:: | ||
CartesianMeshCoarsening(ICartesianMesh* m) | ||
: TraceAccessor(m->traceMng()) | ||
, m_cartesian_mesh(m) | ||
{ | ||
} | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
void CartesianMeshCoarsening:: | ||
coarseCartesianMesh() | ||
{ | ||
IMesh* mesh = m_cartesian_mesh->mesh(); | ||
Integer nb_patch = m_cartesian_mesh->nbPatch(); | ||
if (nb_patch != 1) | ||
ARCANE_FATAL("This method is only valid for 1 patch (nb_patch={0})", nb_patch); | ||
|
||
// TODO: Supprimer les mailles fantômes puis les reconstruire | ||
|
||
Integer nb_dir = mesh->dimension(); | ||
if (nb_dir != 2) | ||
ARCANE_FATAL("This method is only valid for 2D mesh"); | ||
|
||
IParallelMng* pm = mesh->parallelMng(); | ||
if (pm->isParallel()) | ||
ARCANE_FATAL("This method does not work in parallel"); | ||
|
||
for (Integer idir = 0; idir < nb_dir; ++idir) { | ||
CellDirectionMng cdm(m_cartesian_mesh->cellDirection(idir)); | ||
Int32 nb_own_cell = cdm.ownNbCell(); | ||
info() << "NB_OWN_CELL dir=" << idir << " n=" << nb_own_cell; | ||
if ((nb_own_cell % 2) != 0) | ||
ARCANE_FATAL("Invalid number of cells ({0}) for direction {1}. Should be a multiple of 2", | ||
nb_own_cell, idir); | ||
} | ||
} | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
} // End namespace Arcane | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ |
83 changes: 83 additions & 0 deletions
83
arcane/ceapart/src/arcane/cartesianmesh/CartesianMeshCoarsening.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*- | ||
//----------------------------------------------------------------------------- | ||
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
//----------------------------------------------------------------------------- | ||
/*---------------------------------------------------------------------------*/ | ||
/* CartesianMeshCoarsening.h (C) 2000-2023 */ | ||
/* */ | ||
/* Déraffinement d'un maillage cartésien. */ | ||
/*---------------------------------------------------------------------------*/ | ||
#ifndef ARCANE_CARTESIANMESH_CARTESIANMESHCOARSENING_H | ||
#define ARCANE_CARTESIANMESH_CARTESIANMESHCOARSENING_H | ||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
#include "arcane/utils/TraceAccessor.h" | ||
|
||
#include "arcane/cartesianmesh/CartesianMeshGlobal.h" | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
namespace Arcane | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
/*! | ||
* \ingroup ArcaneCartesianMesh | ||
* | ||
* \brief Déraffine un maillage cartésien par 2. | ||
* | ||
* \warning Cette méthode est expérimentale. | ||
* | ||
* Cette classe permet de déraffiner un maillage cartésien. Les instances | ||
* de cette classe sont créées via ICartesianMesh::createCartesianMeshCoarsening(). | ||
* | ||
* Après utilisation, le maillage sera un maillage AMR et le maillage | ||
* initial sera un patch (ICartesianMeshPatch). Les mailles du maillage | ||
* initial seront des mailles de niveau 1. | ||
* | ||
* Le maillage initial doit être cartésien et ne doit pas avoir de patchs. | ||
* | ||
* Le maillage doit être un maillage AMR (IMesh::isAmrActivated()==true). | ||
* | ||
* Le nombre de mailles dans chaque dimension doit être un multiple de 2 | ||
* ainsi que le nombre de mailles locales à chaque sous-domaine. | ||
* | ||
*/ | ||
class ARCANE_CARTESIANMESH_EXPORT CartesianMeshCoarsening | ||
: public TraceAccessor | ||
{ | ||
friend CartesianMeshImpl; | ||
|
||
private: | ||
|
||
explicit CartesianMeshCoarsening(ICartesianMesh* m); | ||
|
||
public: | ||
|
||
/*! | ||
* \brief Déraffine le maillage initial par 2. | ||
* | ||
* Cette méthode est collective. | ||
*/ | ||
void coarseCartesianMesh(); | ||
|
||
private: | ||
|
||
ICartesianMesh* m_cartesian_mesh = nullptr; | ||
}; | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
} // End namespace Arcane | ||
|
||
/*---------------------------------------------------------------------------*/ | ||
/*---------------------------------------------------------------------------*/ | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<cas codename="ArcaneTest" xml:lang="fr" codeversion="1.0"> | ||
<arcane> | ||
<titre>Test CartesianMesh</titre> | ||
|
||
<description>Test des maillages cartesiens 2D</description> | ||
|
||
<boucle-en-temps>CartesianMeshTestLoop</boucle-en-temps> | ||
|
||
<modules> | ||
<module name="ArcanePostProcessing" active="true" /> | ||
</modules> | ||
|
||
</arcane> | ||
|
||
<arcane-post-traitement> | ||
<periode-sortie>1</periode-sortie> | ||
<depouillement> | ||
<variable>Density</variable> | ||
<variable>NodeDensity</variable> | ||
<groupe>AllCells</groupe> | ||
<groupe>AllNodes</groupe> | ||
<groupe>AllFacesDirection0</groupe> | ||
<groupe>AllFacesDirection1</groupe> | ||
</depouillement> | ||
</arcane-post-traitement> | ||
|
||
|
||
<maillage> | ||
<meshgenerator> | ||
<cartesian> | ||
<nsd>2 2</nsd> | ||
<origine>0.0 0.0</origine> | ||
<lx nx='2' prx='1.0'>2.0</lx> | ||
<lx nx='3' prx='1.0'>3.0</lx> | ||
<lx nx='3' prx='1.2'>3.0</lx> | ||
<lx nx='4' prx='2.0'>4.0</lx> | ||
|
||
<ly ny='2' pry='1.0'>2.0</ly> | ||
<ly ny='3' pry='2.0'>3.0</ly> | ||
<ly ny='3' pry='2.0'>3.0</ly> | ||
</cartesian> | ||
</meshgenerator> | ||
</maillage> | ||
|
||
<cartesian-mesh-tester> | ||
<coarse-cartesian-mesh>1</coarse-cartesian-mesh> | ||
</cartesian-mesh-tester> | ||
</cas> |