Commit f51bdd18 authored by Michael Turner's avatar Michael Turner
Browse files

add 2d generator class and fix cad to load 2d files

parent 122fca92
////////////////////////////////////////////////////////////////////////////////
//
// File: SurfaceMeshing.cpp
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: surfacemeshing object methods.
//
////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <NekMeshUtils/2DGenerator/2DGenerator.h>
using namespace std;
namespace Nektar
{
namespace NekMeshUtils
{
ModuleKey Generator2D::className = GetModuleFactory().RegisterCreatorFunction(
ModuleKey(eProcessModule, "2dgenerator"),
Generator2D::create,
"Generates a 2D mesh");
Generator2D::Generator2D(MeshSharedPtr m) : ProcessModule(m)
{
}
Generator2D::~Generator2D()
{
}
void Generator2D::Process()
{
cout << "hello julian" << endl;
//a set of curvemeshes for the cad curve
//a set of facemeshes
}
}
}
////////////////////////////////////////////////////////////////////////////////
//
// File: SurfaceMeshing.h
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: class containing all surfacemeshing routines and classes.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef NEKMESHUTILS_2D_2D
#define NEKMESHUTILS_2D_2D
#include <NekMeshUtils/Module/Module.h>
namespace Nektar
{
namespace NekMeshUtils
{
/**
* @brief class containing all surface meshing routines methods and classes
*/
class Generator2D : public ProcessModule
{
public:
/// Creates an instance of this class
static boost::shared_ptr<Module> create(MeshSharedPtr m)
{
return MemoryManager<Generator2D>::AllocateSharedPtr(m);
}
static ModuleKey className;
Generator2D(MeshSharedPtr m);
virtual ~Generator2D();
virtual void Process();
};
}
}
#endif
......@@ -84,6 +84,7 @@ public:
*/
CADSystem(std::string name) : m_name(name)
{
m_2d = false;
}
~CADSystem()
......@@ -98,6 +99,11 @@ public:
return m_name;
}
void Set2D()
{
m_2d = true;
}
/**
* @brief Initialises CAD and makes surface, curve and vertex maps.
*
......@@ -188,6 +194,8 @@ protected:
std::map<int, CADSurfSharedPtr> m_surfs;
/// Map of vertices
std::map<int, CADVertSharedPtr> m_verts;
bool m_2d;
};
typedef boost::shared_ptr<CADSystem> CADSystemSharedPtr;
......
......@@ -267,7 +267,11 @@ bool CADSystemOCE::LoadCAD()
for (map<int, vector<int> >::iterator it = adjsurfmap.begin();
it != adjsurfmap.end(); it++)
{
ASSERTL0(it->second.size() == 2, "no three curve surfaces");
if(!m_2d)
{
ASSERTL0(it->second.size() == 2, "no three curve surfaces");
}
vector<CADSurfSharedPtr> sfs;
for (int i = 0; i < it->second.size(); i++)
{
......
......@@ -51,6 +51,8 @@ ProcessLoadCAD::ProcessLoadCAD(MeshSharedPtr m) : ProcessModule(m)
{
m_config["filename"] =
ConfigOption(false, "", "Generate prisms on these surfs");
m_config["2D"] =
ConfigOption(true, "", "allow 2d loading");
}
ProcessLoadCAD::~ProcessLoadCAD()
......@@ -66,7 +68,13 @@ void ProcessLoadCAD::Process()
cout << "Loading CAD for " << m_mesh->m_CADId << endl;
}
m_mesh->m_cad = GetEngineFactory().CreateInstance("oce",m_mesh->m_CADId);
if(m_config["2D"].beenSet)
{
m_mesh->m_cad = GetEngineFactory().CreateInstance("oce",m_mesh->m_CADId);
}
m_mesh->m_cad->Set2D();
ASSERTL0(m_mesh->m_cad->LoadCAD(), "Failed to load CAD");
m_mesh->m_hasCAD = true;
......
......@@ -39,6 +39,7 @@ IF(NEKTAR_USE_MESHGEN)
CADSystem/OCE/CADVertOCE.cpp
CADSystem/OCE/CADCurveOCE.cpp
CADSystem/OCE/CADSurfOCE.cpp
2DGenerator/2DGenerator.cpp
)
ENDIF()
......@@ -93,6 +94,7 @@ IF(NEKTAR_USE_MESHGEN)
Optimisation/BGFS-B.h
Optimisation/OptimiseObj.h
Triangle/Triangle.h
2DGenerator/2DGenerator.h
)
ENDIF()
......
......@@ -117,6 +117,7 @@ void InputCAD::ParseFile(string nm)
it = information.find("MeshType");
ASSERTL0(it != information.end(),"no meshtype defined");
it->second == "BL" ? m_makeBL = true : m_makeBL = false;
it->second == "2D" ? m_2D = true : m_2D = false;
it = parameters.find("MinDelta");
ASSERTL0(it != parameters.end(),"no mindelta defined");
......@@ -165,6 +166,11 @@ void InputCAD::Process()
ModuleKey(eProcessModule, "loadcad"), m_mesh));
mods.back()->RegisterConfig("filename", m_cadfile);
if(m_2D)
{
mods.back()->RegisterConfig("2D","");
}
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "loadoctree"), m_mesh));
mods.back()->RegisterConfig("mindel", m_minDelta);
......@@ -195,19 +201,29 @@ void InputCAD::Process()
mods.back()->RegisterConfig("writeoctree",fn + "_oct.xml");
}*/
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "surfacemesh"), m_mesh));
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "volumemesh"), m_mesh));
if(m_makeBL)
if(m_2D)
{
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "2dgenerator"), m_mesh));
}
else
{
mods.back()->RegisterConfig("blsurfs",m_blsurfs);
mods.back()->RegisterConfig("blthick",m_blthick);
mods.back()->RegisterConfig("bllayers",m_bllayers);
mods.back()->RegisterConfig("blprog",m_blprog);
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "surfacemesh"), m_mesh));
mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "volumemesh"), m_mesh));
if(m_makeBL)
{
mods.back()->RegisterConfig("blsurfs",m_blsurfs);
mods.back()->RegisterConfig("blthick",m_blthick);
mods.back()->RegisterConfig("bllayers",m_bllayers);
mods.back()->RegisterConfig("blprog",m_blprog);
}
}
/*mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "hosurface"), m_mesh));
if(m_surfopti)
......
......@@ -63,7 +63,7 @@ public:
private:
std::string m_minDelta, m_maxDelta, m_eps, m_cadfile, m_order,
m_blsurfs, m_blthick, m_blprog, m_bllayers;
bool m_makeBL, m_surfopti;
bool m_makeBL, m_surfopti, m_2D;
};
}
}
......
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