Skip to content

Commit

Permalink
Rename, add test, address comments (#13221)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Apr 18, 2019
1 parent a6bcbf7 commit 1fafcdb
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 33 deletions.
16 changes: 0 additions & 16 deletions framework/doc/content/source/meshgenerators/MergedMeshGenerator.md

This file was deleted.

@@ -0,0 +1,16 @@
# MeshCollectionGenerator

## Overview

The `MeshCollectionGenerator` creates a new mesh that is a collection of
submeshes (provides in the `inputs` parameter`), The submeshes are not linked in
any way and interaction between them only occurs due to contact or other
constraints.

## Further MeshCollectionGenerator Documentation

!syntax parameters /MeshGenerators/MeshCollectionGenerator

!syntax inputs /MeshGenerators/MeshCollectionGenerator

!syntax children /MeshGenerators/MeshCollectionGenerator
Expand Up @@ -7,26 +7,26 @@
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#ifndef MERGEDMESHGENERATOR_H
#define MERGEDMESHGENERATOR_H
#ifndef MESHCOLLECTIONGENERATOR_H
#define MESHCOLLECTIONGENERATOR_H

#include "MeshGenerator.h"
#include "libmesh/replicated_mesh.h"
#include "MooseEnum.h"

// Forward declarations
class MergedMeshGenerator;
class MeshCollectionGenerator;

template <>
InputParameters validParams<MergedMeshGenerator>();
InputParameters validParams<MeshCollectionGenerator>();

/**
* Merge multiple meshes into a single unconnected mesh
* Collects multiple meshes into a single (unconnected) mesh
*/
class MergedMeshGenerator : public MeshGenerator
class MeshCollectionGenerator : public MeshGenerator
{
public:
MergedMeshGenerator(const InputParameters & parameters);
MeshCollectionGenerator(const InputParameters & parameters);

std::unique_ptr<MeshBase> generate() override;

Expand All @@ -38,4 +38,4 @@ class MergedMeshGenerator : public MeshGenerator
std::vector<std::unique_ptr<MeshBase> *> _meshes;
};

#endif // MERGEDMESHGENERATOR_H
#endif // MESHCOLLECTIONGENERATOR_H
Expand Up @@ -7,27 +7,27 @@
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "MergedMeshGenerator.h"
#include "MeshCollectionGenerator.h"

#include "CastUniquePointer.h"
#include "MooseUtils.h"

#include "libmesh/replicated_mesh.h"
#include "libmesh/unstructured_mesh.h"

registerMooseObject("MooseApp", MergedMeshGenerator);
registerMooseObject("MooseApp", MeshCollectionGenerator);

template <>
InputParameters
validParams<MergedMeshGenerator>()
validParams<MeshCollectionGenerator>()
{
InputParameters params = validParams<MeshGenerator>();
params.addClassDescription("Merge multiple meshes into a single unconnected mesh.");
params.addClassDescription("Collects multiple meshes into a single (unconnected) mesh.");
params.addRequiredParam<std::vector<MeshGeneratorName>>("inputs", "The input MeshGenerators.");
return params;
}

MergedMeshGenerator::MergedMeshGenerator(const InputParameters & parameters)
MeshCollectionGenerator::MeshCollectionGenerator(const InputParameters & parameters)
: MeshGenerator(parameters), _input_names(getParam<std::vector<MeshGeneratorName>>("inputs"))
{
// error check
Expand All @@ -40,7 +40,7 @@ MergedMeshGenerator::MergedMeshGenerator(const InputParameters & parameters)
}

std::unique_ptr<MeshBase>
MergedMeshGenerator::generate()
MeshCollectionGenerator::generate()
{
// merge all meshes into the first one
auto mesh = dynamic_pointer_cast<UnstructuredMesh>(*_meshes[0]);
Expand Down
2 changes: 1 addition & 1 deletion modules/heat_conduction/include/materials/GapConductance.h
Expand Up @@ -56,7 +56,7 @@ class GapConductance : public Material

virtual void initialSetup() override;

/// Legacy method that clamps at min_gao
/// Legacy method that clamps at min_gap
static Real gapLength(
const GAP_GEOMETRY & gap_geom, Real radius, Real r1, Real r2, Real min_gap, Real max_gap)
{
Expand Down
Expand Up @@ -25,8 +25,8 @@
ymax = 5
[../]

[./merge]
type = MergedMeshGenerator
[./left_and_right]
type = MeshCollectionGenerator
inputs = 'left right'
[../]
[]
Expand Down
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,35 @@
[MeshGenerators]
[./left]
type = GeneratedMeshGenerator
dim = 2
nx = 3
ny = 3
xmin = -3
xmax = 0
ymin = -5
ymax = 5
[../]
[./right]
type = GeneratedMeshGenerator
dim = 2
nx = 3
ny = 3
xmin = 3
xmax = 6
ymin = -5
ymax = 5
[../]

[./left_and_right]
type = MeshCollectionGenerator
inputs = 'left right'
[../]
[]

[Mesh]
type = MeshGeneratorMesh
[]

[Outputs]
exodus = true
[]
13 changes: 13 additions & 0 deletions test/tests/meshgenerators/mesh_collection_generator/tests
@@ -0,0 +1,13 @@
[Tests]
[./mesh_collection_generator_test]
type = 'Exodiff'
input = 'mesh_collection_generator.i'
cli_args = '--mesh-only'
exodiff = 'mesh_collection_generator_in.e'
requirement = 'MOOSE shall be able to combine multiple meshes into a single unconnected mesh.'
design = 'meshgenerators/MeshCollectionGenerator.md'
issues = '#13221'
mesh_mode = 'REPLICATED'
recover = false
[../]
[]

0 comments on commit 1fafcdb

Please sign in to comment.