InputMCF.cpp 17.8 KB
Newer Older
Michael Turner's avatar
Michael Turner committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
////////////////////////////////////////////////////////////////////////////////
//
//  File: InputCAD.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.
//
Michael Turner's avatar
Michael Turner committed
32
//  Description: create mesh from cad using mesh utils
Michael Turner's avatar
Michael Turner committed
33 34 35
//
////////////////////////////////////////////////////////////////////////////////

36
#include <LibUtilities/BasicUtils/SessionReader.h>
Julian Marcon's avatar
Julian Marcon committed
37 38
#include <NekMeshUtils/CADSystem/CADCurve.h>

39 40
#include <boost/thread.hpp>

41
#include <tinyxml.h>
42

Michael Turner's avatar
Michael Turner committed
43
#include "InputMCF.h"
Michael Turner's avatar
Michael Turner committed
44

Michael Turner's avatar
Michael Turner committed
45
using namespace std;
46
using namespace Nektar::NekMeshUtils;
47 48 49 50 51

namespace Nektar
{
namespace Utilities
{
Michael Turner's avatar
Michael Turner committed
52

Michael Turner's avatar
Michael Turner committed
53 54 55
ModuleKey InputMCF::className = GetModuleFactory().RegisterCreatorFunction(
    ModuleKey(eInputModule, "mcf"), InputMCF::create,
    "Reads mesh configuration and will generate the mesh file.");
Michael Turner's avatar
Michael Turner committed
56 57 58 59

/**
 * @brief Set up InputCAD object.
 */
Michael Turner's avatar
Michael Turner committed
60
InputMCF::InputMCF(MeshSharedPtr m) : InputModule(m)
61
{
Michael Turner's avatar
Michael Turner committed
62
}
Michael Turner's avatar
Michael Turner committed
63

Michael Turner's avatar
Michael Turner committed
64
InputMCF::~InputMCF()
Michael Turner's avatar
Michael Turner committed
65 66
{
}
Michael Turner's avatar
Michael Turner committed
67

Michael Turner's avatar
Michael Turner committed
68
void InputMCF::ParseFile(string nm)
Michael Turner's avatar
Michael Turner committed
69
{
70
    vector<string> filename;
71
    filename.push_back(nm);
72 73
    LibUtilities::SessionReaderSharedPtr pSession =
        LibUtilities::SessionReader::CreateInstance(0, NULL, filename);
Michael Turner's avatar
Michael Turner committed
74

Dave Moxey's avatar
Dave Moxey committed
75 76 77 78 79
    ASSERTL0(pSession->DefinesElement("NEKTAR/MESHING"), "no meshing tag");
    ASSERTL0(pSession->DefinesElement("NEKTAR/MESHING/INFORMATION"),
             "no information tag");
    ASSERTL0(pSession->DefinesElement("NEKTAR/MESHING/PARAMETERS"),
             "no parameters tag");
80 81 82 83

    TiXmlElement *mcf = pSession->GetElement("NEKTAR/MESHING");

    TiXmlElement *info = mcf->FirstChildElement("INFORMATION");
Dave Moxey's avatar
Dave Moxey committed
84 85 86
    TiXmlElement *I    = info->FirstChildElement("I");
    map<string, string> information;
    while (I)
87
    {
Dave Moxey's avatar
Dave Moxey committed
88 89 90
        string tmp1, tmp2;
        I->QueryStringAttribute("PROPERTY", &tmp1);
        I->QueryStringAttribute("VALUE", &tmp2);
91
        information[tmp1] = tmp2;
Dave Moxey's avatar
Dave Moxey committed
92
        I                 = I->NextSiblingElement("I");
93 94 95
    }

    TiXmlElement *param = mcf->FirstChildElement("PARAMETERS");
Dave Moxey's avatar
Dave Moxey committed
96 97 98
    TiXmlElement *P     = param->FirstChildElement("P");
    map<string, string> parameters;
    while (P)
99
    {
Dave Moxey's avatar
Dave Moxey committed
100 101 102
        string tmp1, tmp2;
        P->QueryStringAttribute("PARAM", &tmp1);
        P->QueryStringAttribute("VALUE", &tmp2);
103
        parameters[tmp1] = tmp2;
Dave Moxey's avatar
Dave Moxey committed
104
        P                = P->NextSiblingElement("P");
105 106 107
    }

    set<string> boolparameters;
108

Dave Moxey's avatar
Dave Moxey committed
109
    if (pSession->DefinesElement("NEKTAR/MESHING/BOOLPARAMETERS"))
110
    {
111
        TiXmlElement *bparam = mcf->FirstChildElement("BOOLPARAMETERS");
Dave Moxey's avatar
Dave Moxey committed
112
        TiXmlElement *BP     = bparam->FirstChildElement("P");
113

Dave Moxey's avatar
Dave Moxey committed
114
        while (BP)
115 116
        {
            string tmp;
Dave Moxey's avatar
Dave Moxey committed
117
            BP->QueryStringAttribute("VALUE", &tmp);
118 119 120
            boolparameters.insert(tmp);
            BP = BP->NextSiblingElement("P");
        }
121 122
    }

Michael Turner's avatar
Michael Turner committed
123
    set<string> refinement;
mike's avatar
mike committed
124
    if (pSession->DefinesElement("NEKTAR/MESHING/REFINEMENT"))
Michael Turner's avatar
Michael Turner committed
125 126
    {
        TiXmlElement *refine = mcf->FirstChildElement("REFINEMENT");
mike's avatar
mike committed
127
        TiXmlElement *L      = refine->FirstChildElement("LINE");
Michael Turner's avatar
Michael Turner committed
128 129 130

        while (L)
        {
Michael Turner's avatar
Michael Turner committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
            stringstream ss;
            TiXmlElement *T = L->FirstChildElement("X1");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("Y1");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("Z1");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("X2");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("Y2");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("Z2");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("R");
            ss << T->GetText() << ",";
            T = L->FirstChildElement("D");
            ss << T->GetText();

            refinement.insert(ss.str());

            L = L->NextSiblingElement("LINE");
Michael Turner's avatar
Michael Turner committed
152 153
        }
    }
Michael Turner's avatar
Michael Turner committed
154

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
    set<string> periodic;
    if (pSession->DefinesElement("NEKTAR/MESHING/PERIODIC"))
    {
        TiXmlElement *per  = mcf->FirstChildElement("PERIODIC");
        TiXmlElement *pair = per->FirstChildElement("P");

        while (pair)
        {
            string tmp;
            pair->QueryStringAttribute("PAIR", &tmp);
            periodic.insert(tmp);
            pair = pair->NextSiblingElement("P");
        }
    }

170
    auto it = information.find("CADFile");
Dave Moxey's avatar
Dave Moxey committed
171
    ASSERTL0(it != information.end(), "no cadfile defined");
172
    m_cadfile = it->second;
Dave Moxey's avatar
Dave Moxey committed
173

174
    it = information.find("MeshType");
Dave Moxey's avatar
Dave Moxey committed
175
    ASSERTL0(it != information.end(), "no meshtype defined");
mike's avatar
merge  
mike committed
176

177 178 179
    m_cfiMesh  = it->second == "CFI";
    m_makeBL   = it->second == "3DBndLayer";
    m_2D       = it->second == "2D";
's avatar
committed
180
    m_manifold = it->second == "Manifold";
mike's avatar
mike committed
181

Michael Turner's avatar
Michael Turner committed
182
    if (it->second == "2DBndLayer")
183
    {
184
        m_makeBL = true;
mike's avatar
mike committed
185
        m_2D     = true;
186
    }
mike's avatar
mike committed
187 188

    if (!m_makeBL && !m_2D && !m_manifold && !m_cfiMesh)
Michael Turner's avatar
Michael Turner committed
189 190 191
    {
        ASSERTL0(it->second == "3D", "unsure on MeshType")
    }
192 193

    it = parameters.find("MinDelta");
Dave Moxey's avatar
Dave Moxey committed
194
    ASSERTL0(it != parameters.end(), "no mindelta defined");
195
    m_minDelta = it->second;
Dave Moxey's avatar
Dave Moxey committed
196

197
    it = parameters.find("MaxDelta");
Dave Moxey's avatar
Dave Moxey committed
198
    ASSERTL0(it != parameters.end(), "no maxdelta defined");
199
    m_maxDelta = it->second;
Dave Moxey's avatar
Dave Moxey committed
200

201
    it = parameters.find("EPS");
Dave Moxey's avatar
Dave Moxey committed
202
    ASSERTL0(it != parameters.end(), "no eps defined");
203
    m_eps = it->second;
Dave Moxey's avatar
Dave Moxey committed
204

205
    it = parameters.find("Order");
Dave Moxey's avatar
Dave Moxey committed
206
    ASSERTL0(it != parameters.end(), "no order defined");
207
    m_order = it->second;
Dave Moxey's avatar
Dave Moxey committed
208 209

    if (m_makeBL)
Michael Turner's avatar
Michael Turner committed
210
    {
Michael Turner's avatar
Michael Turner committed
211 212
        it = parameters.find("BndLayerSurfaces");
        ASSERTL0(it != parameters.end(), "no BndLayersurfs defined");
Michael Turner's avatar
Michael Turner committed
213
        m_blsurfs = it->second;
Dave Moxey's avatar
Dave Moxey committed
214

Michael Turner's avatar
Michael Turner committed
215 216
        it = parameters.find("BndLayerThickness");
        ASSERTL0(it != parameters.end(), "no BndLayerthick defined");
Michael Turner's avatar
Michael Turner committed
217
        m_blthick = it->second;
Dave Moxey's avatar
Dave Moxey committed
218

mike's avatar
mike committed
219
        it        = parameters.find("BndLayerLayers");
Michael Turner's avatar
Michael Turner committed
220
        m_splitBL = it != parameters.end();
mike's avatar
mike committed
221
        if (m_splitBL)
Michael Turner's avatar
Michael Turner committed
222 223
        {
            m_bllayers = it->second;
mike's avatar
mike committed
224 225
            it         = parameters.find("BndLayerProgression");
            m_blprog   = it != parameters.end() ? it->second : "2.0";
Michael Turner's avatar
Michael Turner committed
226
        }
Michael Turner's avatar
Michael Turner committed
227

228 229 230
        it = parameters.find("BndLayerAdjustment");
        if (it != parameters.end())
        {
231
            m_adjust     = true;
232 233 234 235 236 237
            m_adjustment = it->second;
        }
        else
        {
            m_adjust = false;
        }
Michael Turner's avatar
Michael Turner committed
238
    }
239

240
    m_naca = false;
mike's avatar
mike committed
241
    if (m_2D && m_cadfile.find('.') == std::string::npos)
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
    {
        m_naca = true;

        stringstream ss;
        it = parameters.find("Xmin");
        ASSERTL0(it != parameters.end(), "no xmin defined");
        ss << it->second << ",";
        it = parameters.find("Ymin");
        ASSERTL0(it != parameters.end(), "no ymin defined");
        ss << it->second << ",";
        it = parameters.find("Xmax");
        ASSERTL0(it != parameters.end(), "no xmax defined");
        ss << it->second << ",";
        it = parameters.find("Ymax");
        ASSERTL0(it != parameters.end(), "no zmax defined");
        ss << it->second << ",";
        it = parameters.find("AOA");
        ASSERTL0(it != parameters.end(), "no aoa defined");
        ss << it->second;

        m_nacadomain = ss.str();
    }

265
    auto sit    = boolparameters.find("SurfaceOptimiser");
266 267 268 269 270 271 272
    m_surfopti  = sit != boolparameters.end();
    sit         = boolparameters.find("WriteOctree");
    m_woct      = sit != boolparameters.end();
    sit         = boolparameters.find("VariationalOptimiser");
    m_varopti   = sit != boolparameters.end();
    sit         = boolparameters.find("BndLayerAdjustEverywhere");
    m_adjustall = sit != boolparameters.end();
Michael Turner's avatar
Michael Turner committed
273 274

    m_refine = refinement.size() > 0;
mike's avatar
mike committed
275
    if (m_refine)
Michael Turner's avatar
Michael Turner committed
276 277
    {
        stringstream ss;
mike's avatar
mike committed
278
        for (sit = refinement.begin(); sit != refinement.end(); sit++)
Michael Turner's avatar
Michael Turner committed
279 280 281 282 283
        {
            ss << *sit;
            ss << ":";
        }
        m_refinement = ss.str();
mike's avatar
mike committed
284
        m_refinement.erase(m_refinement.end() - 1);
Michael Turner's avatar
Michael Turner committed
285
    }
286 287 288 289 290 291 292 293 294 295 296 297

    if (periodic.size() > 0)
    {
        stringstream ss;
        for (sit = periodic.begin(); sit != periodic.end(); ++sit)
        {
            ss << *sit;
            ss << ":";
        }
        m_periodic = ss.str();
        m_periodic.erase(m_periodic.end() - 1);
    }
298 299
}

Michael Turner's avatar
Michael Turner committed
300
void InputMCF::Process()
301 302
{
    ParseFile(m_config["infile"].as<string>());
303

304 305
    m_mesh->m_expDim   = 3;
    m_mesh->m_spaceDim = 3;
Dave Moxey's avatar
Dave Moxey committed
306
    m_mesh->m_nummode  = boost::lexical_cast<int>(m_order) + 1;
307

308
    ModuleSharedPtr module;
309

310
    ////**** CAD ****////
311 312 313
    module = GetModuleFactory().CreateInstance(
        ModuleKey(eProcessModule, "loadcad"), m_mesh);
    module->RegisterConfig("filename", m_cadfile);
314
    if (m_mesh->m_verbose)
cadfix's avatar
fix  
cadfix committed
315 316 317
    {
        module->RegisterConfig("verbose", "");
    }
mike's avatar
mike committed
318
    if (m_2D)
319
    {
320
        module->RegisterConfig("2D", "");
321
    }
mike's avatar
mike committed
322
    if (m_naca)
323
    {
324
        module->RegisterConfig("NACA", m_nacadomain);
325
    }
326

327
    if (m_cfiMesh)
328
    {
mike's avatar
mike committed
329
        module->RegisterConfig("CFIMesh", "");
330
    }
331

332 333 334
    module->SetDefaults();
    module->Process();

mike's avatar
mike committed
335
    if (!m_cfiMesh)
336
    {
mike's avatar
mike committed
337 338 339 340 341 342
        ////**** OCTREE ****////
        module = GetModuleFactory().CreateInstance(
            ModuleKey(eProcessModule, "loadoctree"), m_mesh);
        module->RegisterConfig("mindel", m_minDelta);
        module->RegisterConfig("maxdel", m_maxDelta);
        module->RegisterConfig("eps", m_eps);
mike's avatar
mike committed
343 344
        if (m_refine)
        {
mike's avatar
mike committed
345
            module->RegisterConfig("refinement", m_refinement);
mike's avatar
mike committed
346 347 348
        }
        if (m_woct)
        {
mike's avatar
mike committed
349
            module->RegisterConfig("writeoctree", "");
mike's avatar
mike committed
350
        }
mike's avatar
mike committed
351 352 353

        module->SetDefaults();
        module->Process();
354
    }
355

356
    ////**** LINEAR MESHING ****////
mike's avatar
mike committed
357
    if (m_2D)
358
    {
359
        ////**** 2DGenerator ****////
360
        m_mesh->m_expDim   = 2;
Michael Turner's avatar
Michael Turner committed
361
        m_mesh->m_spaceDim = 2;
362 363
        module             = GetModuleFactory().CreateInstance(
            ModuleKey(eProcessModule, "2dgenerator"), m_mesh);
364 365
        if (m_makeBL)
        {
366 367
            module->RegisterConfig("blcurves", m_blsurfs);
            module->RegisterConfig("blthick", m_blthick);
368 369 370 371 372 373 374 375 376 377 378 379 380 381

            if (m_adjust)
            {
                module->RegisterConfig("bltadjust", m_adjustment);

                if (m_adjustall)
                {
                    module->RegisterConfig("adjustblteverywhere", "");
                }
            }
        }
        if (m_periodic.size())
        {
            module->RegisterConfig("periodic", m_periodic);
382
        }
Michael Turner's avatar
Michael Turner committed
383

384 385 386 387
        try
        {
            module->SetDefaults();
            module->Process();
388
        }
389
        catch (runtime_error &e)
390
        {
391 392 393 394
            cout << "2D linear mesh generator failed with message:" << endl;
            cout << e.what() << endl;
            cout << "No mesh file has been created" << endl;
            abort();
395
        }
396
    }
397
    else
398
    {
mike's avatar
mike committed
399
        ////**** Possible Mesh Sources ****////
mike's avatar
mike committed
400
        if (m_cfiMesh)
mike's avatar
mike committed
401 402
        {
            ////**** CFI mesh ****////
mike's avatar
mike committed
403 404 405
            module = GetModuleFactory().CreateInstance(
                ModuleKey(eProcessModule, "cfimesh"), m_mesh);

406 407
            module->SetDefaults();
            module->Process();
mike's avatar
mike committed
408 409
        }
        else
410
        {
mike's avatar
mike committed
411
            ////**** SurfaceMesh ****////
's avatar
committed
412
            module = GetModuleFactory().CreateInstance(
mike's avatar
mike committed
413
                ModuleKey(eProcessModule, "surfacemesh"), m_mesh);
414

's avatar
committed
415
            try
mike's avatar
mike committed
416
            {
's avatar
committed
417 418 419 420 421
                module->SetDefaults();
                module->Process();
            }
            catch (runtime_error &e)
            {
mike's avatar
mike committed
422
                cout << "Surface meshing has failed with message:" << endl;
's avatar
committed
423
                cout << e.what() << endl;
mike's avatar
mike committed
424 425
                cout << "Any surfaces which were succsessfully meshed will be "
                        "dumped as a manifold mesh"
's avatar
committed
426 427 428 429 430 431 432 433
                     << endl;
                m_mesh->m_expDim = 2;
                ProcessVertices();
                ProcessEdges();
                ProcessFaces();
                ProcessElements();
                ProcessComposites();
                return;
mike's avatar
mike committed
434
            }
435

436
            if (m_manifold)
mike's avatar
mike committed
437
            {
438
                // dont want to volume mesh
mike's avatar
mike committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452
                m_mesh->m_expDim = 2;
            }
            else
            {
                ////**** VolumeMesh ****////
                module = GetModuleFactory().CreateInstance(
                    ModuleKey(eProcessModule, "volumemesh"), m_mesh);
                if (m_makeBL)
                {
                    module->RegisterConfig("blsurfs", m_blsurfs);
                    module->RegisterConfig("blthick", m_blthick);
                    module->RegisterConfig("bllayers", m_bllayers);
                    module->RegisterConfig("blprog", m_blprog);
                }
mike's avatar
mike committed
453

mike's avatar
mike committed
454 455 456 457 458 459 460 461 462
                try
                {
                    module->SetDefaults();
                    module->Process();
                }
                catch (runtime_error &e)
                {
                    cout << "Volume meshing has failed with message:" << endl;
                    cout << e.what() << endl;
463 464
                    cout << "The linear surface mesh be dumped as a manifold "
                            "mesh"
mike's avatar
mike committed
465 466 467 468 469 470 471 472 473 474 475
                         << endl;
                    m_mesh->m_expDim = 2;
                    m_mesh->m_element[3].clear();
                    ProcessVertices();
                    ProcessEdges();
                    ProcessFaces();
                    ProcessElements();
                    ProcessComposites();
                    return;
                }
            }
476
        }
Michael Turner's avatar
Michael Turner committed
477
    }
mike's avatar
mike committed
478

479
    ////**** HOSurface ****////
480 481
    module = GetModuleFactory().CreateInstance(
        ModuleKey(eProcessModule, "hosurface"), m_mesh);
Dave Moxey's avatar
Dave Moxey committed
482
    if (m_surfopti)
Michael Turner's avatar
Michael Turner committed
483
    {
mike's avatar
mike committed
484 485 486 487 488 489 490
        module->RegisterConfig("opti", "");
    }

    try
    {
        module->SetDefaults();
        module->Process();
491
    }
492
    catch (runtime_error &e)
mike's avatar
mike committed
493
    {
494 495 496 497 498
        cout << "High-order surface meshing has failed with message:" << endl;
        cout << e.what() << endl;
        cout << "The mesh will be written as normal but the incomplete surface "
                "will remain faceted"
             << endl;
mike's avatar
mike committed
499 500 501
        return;
    }

502
    ////*** VARIATIONAL OPTIMISATION ****////
mike's avatar
mike committed
503
    if (m_varopti)
504 505
    {
        unsigned int np = boost::thread::physical_concurrency();
mike's avatar
mike committed
506
        if (m_mesh->m_verbose)
507
        {
mike's avatar
mike committed
508 509
            cout << "Detecting 4 cores, will attempt to run in parrallel"
                 << endl;
510
        }
511 512 513 514
        module = GetModuleFactory().CreateInstance(
            ModuleKey(eProcessModule, "varopti"), m_mesh);
        module->RegisterConfig("hyperelastic", "");
        module->RegisterConfig("maxiter", "10");
515
        module->RegisterConfig("numthreads", boost::lexical_cast<string>(np));
516

517
        try
518
        {
519 520 521 522 523 524 525 526 527
            module->SetDefaults();
            module->Process();
        }
        catch (runtime_error &e)
        {
            cout << "Variational optimisation has failed with message:" << endl;
            cout << e.what() << endl;
            cout << "The mesh will be written as is, it may be invalid" << endl;
            return;
528 529 530
        }
    }

Michael Turner's avatar
Michael Turner committed
531
    ////**** SPLIT BL ****////
mike's avatar
mike committed
532
    if (m_splitBL)
Michael Turner's avatar
Michael Turner committed
533
    {
534 535 536 537
        module = GetModuleFactory().CreateInstance(
            ModuleKey(eProcessModule, "bl"), m_mesh);
        module->RegisterConfig("layers", m_bllayers);
        module->RegisterConfig("surf", m_blsurfs);
538 539
        module->RegisterConfig("nq",
                               boost::lexical_cast<string>(m_mesh->m_nummode));
540
        module->RegisterConfig("r", m_blprog);
541 542 543 544 545 546 547 548 549 550 551 552 553

        try
        {
            module->SetDefaults();
            module->Process();
        }
        catch (runtime_error &e)
        {
            cout << "Boundary layer splitting has failed with message:" << endl;
            cout << e.what() << endl;
            cout << "The mesh will be written as is, it may be invalid" << endl;
            return;
        }
554
    }
Michael Turner's avatar
Michael Turner committed
555

556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
    // apply surface labels
    for (auto &it : m_mesh->m_composite)
    {
        ElementSharedPtr el = it.second->m_items[0];
        if (el->m_parentCAD)
        {
            string name = el->m_parentCAD->GetName();
            if (name.size() > 0)
            {
                m_mesh->m_faceLabels.insert(
                    make_pair(el->GetTagList()[0], name));
            }
        }
    }
    ProcessComposites();

572 573
    ////**** Peralign ****////
    if (m_2D && m_periodic.size())
Julian Marcon's avatar
Julian Marcon committed
574 575 576 577
    {
        vector<string> lines;
        boost::split(lines, m_periodic, boost::is_any_of(":"));

578
        for (auto &il : lines)
Julian Marcon's avatar
Julian Marcon committed
579
        {
580
            module = GetModuleFactory().CreateInstance(
's avatar
fix  
committed
581
                ModuleKey(eProcessModule, "peralign"), m_mesh);
mike's avatar
merge  
mike committed
582

583
            vector<string> tmp(2);
584
            boost::split(tmp, il, boost::is_any_of(","));
585
            module->RegisterConfig("surf1", tmp[0]);
586
            module->RegisterConfig("surf2", tmp[1]);
Julian Marcon's avatar
Julian Marcon committed
587

588 589 590
            module->SetDefaults();
            module->Process();
        }
mike's avatar
mike committed
591
    }
Michael Turner's avatar
Michael Turner committed
592
}
Michael Turner's avatar
Michael Turner committed
593
}
594
}