MeshGraph.cpp 139 KB
Newer Older
Mike Kirby's avatar
Mike Kirby committed
1
2
////////////////////////////////////////////////////////////////////////////////
//
Blake Nelson's avatar
Blake Nelson committed
3
//  File:  $Source: /usr/sci/projects/Nektar/cvs/Nektar++/library/SpatialDomains/MeshGraph.cpp,v $
Mike Kirby's avatar
Mike Kirby committed
4
5
6
7
8
9
//
//  For more information, please see: http://www.nektar.info/
//
//  The MIT License
//
//  Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10
//  Department of Aeronautics, Imperial College London (UK), and Scientific
Mike Kirby's avatar
Mike Kirby committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//  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.
//
32
//  Description:
Mike Kirby's avatar
Mike Kirby committed
33
34
35
36
37
//
//
////////////////////////////////////////////////////////////////////////////////
#include "pchSpatialDomains.h"

Joe Frazier's avatar
Joe Frazier committed
38
39
#include <boost/foreach.hpp>

Mike Kirby's avatar
Mike Kirby committed
40
#include <SpatialDomains/MeshGraph.h>
41
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
Mike Kirby's avatar
Mike Kirby committed
42
43

// Use the stl version, primarily for string.
Blake Nelson's avatar
Blake Nelson committed
44
#ifndef TIXML_USE_STL
Mike Kirby's avatar
Mike Kirby committed
45
#define TIXML_USE_STL
Blake Nelson's avatar
Blake Nelson committed
46
47
#endif

Mike Kirby's avatar
Mike Kirby committed
48
#include <tinyxml/tinyxml.h>
49
#include <cstring>
Sophia Han's avatar
Sophia Han committed
50
#include <sstream>
Claes Eskilsson's avatar
Claes Eskilsson committed
51
#include <cmath>
Mike Kirby's avatar
Mike Kirby committed
52

53
54
#include <SpatialDomains/MeshGraph1D.h>
#include <SpatialDomains/MeshGraph2D.h>
Michael DeLisi's avatar
Michael DeLisi committed
55
#include <SpatialDomains/MeshGraph3D.h>
56

57
58
59
60
61
// These are required for the Write(...) and Import(...) functions.
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/iostreams/copy.hpp>
62
#include <boost/iostreams/filter/zlib.hpp>
63
64
#include <boost/iostreams/filtering_stream.hpp>

Mike Kirby's avatar
Mike Kirby committed
65
66
namespace Nektar
{
67
68
    namespace SpatialDomains
    {
69

70
71
72
73
74
        MeshGraph::MeshGraph():
            m_meshDimension(3),
            m_spaceDimension(3)
        {
        }
75

76
77
78
79
80
        MeshGraph::MeshGraph(unsigned int meshDimension, unsigned int spaceDimension) :
            m_meshDimension(meshDimension),
            m_spaceDimension(spaceDimension)
        {
        }
81

Chris Cantwell's avatar
Chris Cantwell committed
82
        MeshGraph::MeshGraph(const LibUtilities::SessionReaderSharedPtr &pSession)
83
84
85
86
87
            : m_session(pSession)
        {

        }

88
        boost::shared_ptr<MeshGraph> MeshGraph::Read(const std::string& infilename, bool pReadExpansions)
89
90
        {
            boost::shared_ptr<MeshGraph> returnval;
91

92
            MeshGraph mesh;
93

94
95
            mesh.ReadGeometry(infilename);
            int meshDim = mesh.GetMeshDimension();
96

97
98
99
100
101
            switch(meshDim)
            {
            case 1:
                returnval = MemoryManager<MeshGraph1D>::AllocateSharedPtr();
                break;
102

103
104
105
            case 2:
                returnval = MemoryManager<MeshGraph2D>::AllocateSharedPtr();
                break;
106

107
108
109
            case 3:
                returnval = MemoryManager<MeshGraph3D>::AllocateSharedPtr();
                break;
110

111
112
113
114
115
116
117
            default:
                std::string err = "Invalid mesh dimension: ";
                std::stringstream strstrm;
                strstrm << meshDim;
                err += strstrm.str();
                NEKERROR(ErrorUtil::efatal, err.c_str());
            }
118

119
120
121
122
            if (returnval)
            {
                returnval->ReadGeometry(infilename);
                returnval->ReadGeometryInfo(infilename);
123
124
125
126
                if (pReadExpansions)
                {
                    returnval->ReadExpansions(infilename);
                }
127
128
129
            }
            return returnval;
        }
130

131
        void MeshGraph::SetExpansions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef)
132
        {
133
            int i,j,k,g,h,cnt,id;
134
            GeometrySharedPtr geom;
135
            
136
            ExpansionMapShPtr expansionMap;
137

138
139
140
            // Loop over fields and determine unique fields string and
            // declare whole expansion list
            for(i = 0; i < fielddef.size(); ++i)
141
            {
142
                for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
143
                {
144
                    std::string field = fielddef[i]->m_fields[j];
145
                    if(m_expansionMapShPtrMap.count(field) == 0)
146
                    {
147
148
                        expansionMap = MemoryManager<ExpansionMap>::AllocateSharedPtr();
                        m_expansionMapShPtrMap[field] = expansionMap;
149
150
                        
                        // check to see if DefaultVar also not set and if so assign it to this expansion
151
                        if(m_expansionMapShPtrMap.count("DefaultVar") == 0)
152
                        {
153
                            m_expansionMapShPtrMap["DefaultVar"] = expansionMap;
154
                        }
155

156
157
158
159
160
161
162
                        // loop over all elements and set expansion
                        for(k = 0; k < fielddef.size(); ++k)
                        {
                            for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
                            {
                                if(fielddef[k]->m_fields[h] == field)
                                {
163
                                    expansionMap = m_expansionMapShPtrMap.find(field)->second;
164
165
166
167
168
169
                                    LibUtilities::BasisKeyVector def;
                                    
                                    for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
                                    {
                                        ExpansionShPtr tmpexp =
                                            MemoryManager<Expansion>::AllocateSharedPtr(geom, def);
170
                                        (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
171
172
173
174
175
                                    }
                                }
                            }
                        }
                    }
176
                }
177
178
            }                    
            
179
180
            // loop over all elements find the geometry shared ptr and
            // set up basiskey vector
181
182
            for(i = 0; i < fielddef.size(); ++i)
            {
183
                cnt = 0;
184
                std::vector<std::string>  fields = fielddef[i]->m_fields;
185
186
187
188
189
190
191
192
193
194
195
196
197
198
                std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
                std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
                bool pointDef = fielddef[i]->m_pointsDef;
                bool numPointDef = fielddef[i]->m_numPointsDef;

                // Check points and numpoints
                std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
                std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;

                bool UniOrder =  fielddef[i]->m_uniOrder;

                int check = 0;
                for(j=0; j< basis.size(); ++j)
                {
199
                    if( (strcmp(LibUtilities::BasisTypeMap[basis[j]], "Modified_A") == 0) ||
200
                        (strcmp(LibUtilities::BasisTypeMap[basis[j]], "Modified_B") == 0) ||
Spencer Sherwin's avatar
Spencer Sherwin committed
201
                        (strcmp(LibUtilities::BasisTypeMap[basis[j]], "Modified_C") == 0) ||
202
                        (strcmp(LibUtilities::BasisTypeMap[basis[j]], "Fourier") == 0) )
203
                    {
204
                        check++;
205
                    }
206
                }
207

208
209
210
211
212
213
214
                if(check==basis.size())
                {
                    for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
                    {

                        LibUtilities::BasisKeyVector bkeyvec;
                        id = fielddef[i]->m_elementIDs[j];
215
                        
216
217
218
219
                        switch(fielddef[i]->m_shapeType)
                        {
                        case eSegment:
                            {
220
221
222
                                ASSERTL0(m_segGeoms.count(fielddef[i]->m_elementIDs[j]),
                                        "Failed to find geometry with same global id");
                                geom = m_segGeoms[fielddef[i]->m_elementIDs[j]];
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240

                                LibUtilities::PointsKey pkey(nmodes[cnt]+1,LibUtilities::eGaussLobattoLegendre);

                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey1(npoints[cnt],points[0]);
                                    pkey = pkey1;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey1(nmodes[cnt]+1,points[0]);
                                    pkey = pkey1;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey1(npoints[cnt],LibUtilities::eGaussLobattoLegendre);
                                    pkey = pkey1;
                                }
241

242
243
244
245
246
247
248
249
250
251
252
                                LibUtilities::BasisKey bkey(basis[0],nmodes[cnt],pkey);

                                if(!UniOrder)
                                {
                                    cnt++;
                                }
                                bkeyvec.push_back(bkey);
                            }
                            break;
                        case eTriangle:
                            {
253
254
255
                                ASSERTL0(m_triGeoms.count(fielddef[i]->m_elementIDs[j]),
                                        "Failed to find geometry with same global id");
                                geom = m_triGeoms[fielddef[i]->m_elementIDs[j]];
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

                                LibUtilities::PointsKey pkey(nmodes[cnt]+1,LibUtilities::eGaussLobattoLegendre);
                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt],points[0]);
                                    pkey = pkey2;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(nmodes[cnt]+1,points[0]);
                                    pkey = pkey2;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt],LibUtilities::eGaussLobattoLegendre);
                                    pkey = pkey2;
                                }
                                LibUtilities::BasisKey bkey(basis[0],nmodes[cnt],pkey);

                                bkeyvec.push_back(bkey);

                                LibUtilities::PointsKey pkey1(nmodes[cnt+1],LibUtilities::eGaussRadauMAlpha1Beta0);
                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+1],points[1]);
                                    pkey1 = pkey2;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(nmodes[cnt+1],points[1]);
                                    pkey1 = pkey2;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+1],LibUtilities::eGaussRadauMAlpha1Beta0);
                                    pkey1 = pkey2;
                                }
                                LibUtilities::BasisKey bkey1(basis[1],nmodes[cnt+1],pkey1);
                                bkeyvec.push_back(bkey1);

                                if(!UniOrder)
                                {
                                    cnt += 2;
                                }
                            }
                            break;
                        case eQuadrilateral:
                            {
304
305
306
307
                                ASSERTL0(m_quadGeoms.count(fielddef[i]->m_elementIDs[j]),
                                        "Failed to find geometry with same global id");
                                geom = m_quadGeoms[fielddef[i]->m_elementIDs[j]];

308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
                                for(int b = 0; b < 2; ++b)
                                {
                                    LibUtilities::PointsKey pkey(nmodes[cnt+b]+1,LibUtilities::eGaussLobattoLegendre);

                                    if(numPointDef&&pointDef)
                                    {
                                        const LibUtilities::PointsKey pkey2(npoints[cnt+b],points[b]);
                                        pkey = pkey2;
                                    }
                                    else if(!numPointDef&&pointDef)
                                    {
                                        const LibUtilities::PointsKey pkey2(nmodes[cnt+b]+1,points[b]);
                                        pkey = pkey2;
                                    }
                                    else if(numPointDef&&!pointDef)
                                    {
                                        const LibUtilities::PointsKey pkey2(npoints[cnt+b],LibUtilities::eGaussLobattoLegendre);
                                        pkey = pkey2;
                                    }
                                    LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                    bkeyvec.push_back(bkey);
                                }

                                if(!UniOrder)
                                {
                                    cnt += 2;
                                }
                            }
                            break;
Spencer Sherwin's avatar
Spencer Sherwin committed
337
338
339
340
341
342
343
344
345
346

                    case eTetrahedron:
                        {
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_tetGeoms.find(k) != m_tetGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_tetGeoms[k];
                            
                            for(int b = 0; b < 3; ++b)
                            {
Chris Cantwell's avatar
Chris Cantwell committed
347
                                LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]);
Spencer Sherwin's avatar
Spencer Sherwin committed
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384

                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],points[b]);
                                    pkey = pkey2;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(nmodes[cnt+b]+1,points[b]);
                                    pkey = pkey2;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],LibUtilities::eGaussLobattoLegendre);
                                    pkey = pkey2;
                                }
                                
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);

                                bkeyvec.push_back(bkey);
                            }

                            if(!UniOrder)
                            {
                                cnt += 3;
                            }
                        }
                        break;
                    case ePrism:
                        {
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_prismGeoms.find(k) != m_prismGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_prismGeoms[k];

                            for(int b = 0; b < 3; ++b)
                            {
Chris Cantwell's avatar
Chris Cantwell committed
385
                                LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]);
Spencer Sherwin's avatar
Spencer Sherwin committed
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
                                
                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],points[b]);
                                    pkey = pkey2;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(nmodes[cnt+b]+1,points[b]);
                                    pkey = pkey2;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],LibUtilities::eGaussLobattoLegendre);
                                    pkey = pkey2;
                                }
                            
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }
                            
                            if(!UniOrder)
                            {
                                cnt += 3;
                            }
                        }
                        break;
                    case eHexahedron:
                        {
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_hexGeoms.find(k) != m_hexGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_hexGeoms[k];

                            for(int b = 0; b < 3; ++b)
                            {
Chris Cantwell's avatar
Chris Cantwell committed
422
                                LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]);
Spencer Sherwin's avatar
Spencer Sherwin committed
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449

                                if(numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],points[b]);
                                    pkey = pkey2;
                                }
                                else if(!numPointDef&&pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(nmodes[cnt+b]+1,points[b]);
                                    pkey = pkey2;
                                }
                                else if(numPointDef&&!pointDef)
                                {
                                    const LibUtilities::PointsKey pkey2(npoints[cnt+b],LibUtilities::eGaussLobattoLegendre);
                                    pkey = pkey2;
                                }
                                
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }

                            if(!UniOrder)
                            {
                                cnt += 3;
                            }
                        }
                        break;
450
                        default:
Spencer Sherwin's avatar
Spencer Sherwin committed
451
                            ASSERTL0(false,"Need to set up for pyramid and prism 3D Expansions");
452
453
                            break;
                        }
Spencer Sherwin's avatar
Spencer Sherwin committed
454
                        
455
456
                        for(k = 0; k < fields.size(); ++k)
                        {
457
458
459
                            expansionMap = m_expansionMapShPtrMap.find(fields[k])->second;
                            (*expansionMap)[id]->m_geomShPtr = geom;
                            (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
460
                        }
461
462
463
                    }
                }
                else
464
                {
465
                    ASSERTL0(false,"Need to set up for non Modified basis");
466
                }
467
            }
468
        }
469
470


471
        void MeshGraph::SetExpansions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef, std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
472
        {
473
474
            
            int i,j,k,g,h,cnt,id;
475
            GeometrySharedPtr geom;
476

477
            ExpansionMapShPtr expansionMap;
478

479
480
481
482
483
            // Loop over fields and determine unique fields string and
            // declare whole expansion list
            for(i = 0; i < fielddef.size(); ++i)
            {
                for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
484
                {
485
                    std::string field = fielddef[i]->m_fields[j];
486
                    if(m_expansionMapShPtrMap.count(field) == 0)
487
                    {
488
489
                        expansionMap = MemoryManager<ExpansionMap>::AllocateSharedPtr();
                        m_expansionMapShPtrMap[field] = expansionMap;
490
491
                        
                        // check to see if DefaultVar also not set and if so assign it to this expansion
492
                        if(m_expansionMapShPtrMap.count("DefaultVar") == 0)
493
                        {
494
                            m_expansionMapShPtrMap["DefaultVar"] = expansionMap;
495
                        }
496

497
498
499
500
501
502
503
                        // loop over all elements and set expansion
                        for(k = 0; k < fielddef.size(); ++k)
                        {
                            for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
                            {
                                if(fielddef[k]->m_fields[h] == field)
                                {
504
                                    expansionMap = m_expansionMapShPtrMap.find(field)->second;
505
506
507
508
509
510
                                    LibUtilities::BasisKeyVector def;
                                    
                                    for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
                                    {
                                        ExpansionShPtr tmpexp =
                                            MemoryManager<Expansion>::AllocateSharedPtr(geom, def);
511
                                        (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
512
513
514
515
516
                                    }
                                }
                            }
                        }
                    }
517
                }
518
            }                    
519
520


521
522
523
524
525
            // loop over all elements find the geometry shared ptr and
            // set up basiskey vector
            for(i = 0; i < fielddef.size(); ++i)
            {
                cnt = 0;
526
                std::vector<std::string>  fields = fielddef[i]->m_fields;
527
528
529
                std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
                std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
                bool UniOrder =  fielddef[i]->m_uniOrder;
530

531
532
                for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
                {
533

534
535
                    LibUtilities::BasisKeyVector bkeyvec;
                    id = fielddef[i]->m_elementIDs[j];
536

537
538
539
540
                    switch(fielddef[i]->m_shapeType)
                    {
                    case eSegment:
                        {
541
542
543
544
545
546
547
548
549
550
551
552
553
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_segGeoms.find(k) != m_segGeoms.end(),
                                     "Failed to find geometry with same global id.");
                            geom = m_segGeoms[k];
//                            for(k = 0; k < m_segGeoms.size();++k)
//                            {
//                                if(m_segGeoms[k]->GetGlobalID() == fielddef[i]->m_elementIDs[j])
//                                {
//                                    geom = m_segGeoms[k];
//                                    break;
//                                }
//                            }
//                            ASSERTL0(k != m_segGeoms.size(),"Failed to find geometry with same global id");
554

555
556
557
558
559
560
561
562
563
564
565
                            const LibUtilities::PointsKey pkey(nmodes[cnt],pointstype[i][0]);
                            LibUtilities::BasisKey bkey(basis[0],nmodes[cnt],pkey);
                            if(!UniOrder)
                            {
                                cnt++;
                            }
                            bkeyvec.push_back(bkey);
                        }
                        break;
                    case eTriangle:
                        {
566
567
568
569
570
571
572
573
574
575
576
577
578
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_triGeoms.find(k) != m_triGeoms.end(),
                                     "Failed to find geometry with same global id.");
                            geom = m_triGeoms[k];
//                            for(k = 0; k < m_triGeoms.size();++k)
//                            {
//                                if(m_triGeoms[k]->GetGlobalID() == fielddef[i]->m_elementIDs[j])
//                                {
//                                    geom = m_triGeoms[k];
//                                    break;
//                                }
//                            }
//                            ASSERTL0(k != m_triGeoms.size(),"Failed to find geometry with same global id");
579
580
581
582
583
584
                            for(int b = 0; b < 2; ++b)
                            {
                                const LibUtilities::PointsKey pkey(nmodes[cnt+b],pointstype[i][b]);
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }
585

586
587
588
589
590
591
592
593
                            if(!UniOrder)
                            {
                                cnt += 2;
                            }
                        }
                        break;
                    case eQuadrilateral:
                        {
594
595
596
597
598
599
600
601
602
603
604
605
606
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_quadGeoms.find(k) != m_quadGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_quadGeoms[k];
//                            for(k = 0; k < m_quadGeoms.size();++k)
//                            {
//                                if(m_quadGeoms[k]->GetGlobalID() == fielddef[i]->m_elementIDs[j])
//                                {
//                                    geom = m_quadGeoms[k];
//                                    break;
//                                }
//                            }
//                            ASSERTL0(k != m_quadGeoms.size(),"Failed to find geometry with same global id");
607

608
609
610
611
612
613
                            for(int b = 0; b < 2; ++b)
                            {
                                const LibUtilities::PointsKey pkey(nmodes[cnt+b],pointstype[i][b]);
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }
614

615
616
617
618
619
620
621
622
                            if(!UniOrder)
                            {
                                cnt += 2;
                            }
                        }
                        break;
                    case eTetrahedron:
                        {
623
624
625
626
627
628
629
630
631
632
633
634
635
636
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_tetGeoms.find(k) != m_tetGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_tetGeoms[k];

//                            for(k = 0; k < m_tetGeoms.size();++k)
//                            {
//                                if(m_tetGeoms[k]->GetGlobalID() == fielddef[i]->m_elementIDs[j])
//                                {
//                                    geom = m_tetGeoms[k];
//                                    break;
//                                }
//                            }
//                            ASSERTL0(k != m_tetGeoms.size(),"Failed to find geometry with same global id");
637
638
639
640
641
642
                            for(int b = 0; b < 3; ++b)
                            {
                                const LibUtilities::PointsKey pkey(nmodes[cnt+b],pointstype[i][b]);
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }
643

644
645
646
647
648
649
                            if(!UniOrder)
                            {
                                cnt += 2;
                            }
                        }
                        break;
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
                    case ePrism:
                        {
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_prismGeoms.find(k) != m_prismGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_prismGeoms[k];

                            for(int b = 0; b < 3; ++b)
                            {
                                const LibUtilities::PointsKey pkey(nmodes[cnt+b],pointstype[i][b]);
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }

                            if(!UniOrder)
                            {
                                cnt += 2;
                            }
                        }
                        break;
670
671
                    case eHexahedron:
                        {
672
673
674
675
676
677
678
679
680
681
682
683
684
                            k = fielddef[i]->m_elementIDs[j];
                            ASSERTL0(m_hexGeoms.find(k) != m_hexGeoms.end(),
                                    "Failed to find geometry with same global id");
                            geom = m_hexGeoms[k];
//                            for(k = 0; k < m_quadGeoms.size();++k)
//                            {
//                                if(m_hexGeoms[k]->GetGlobalID() == fielddef[i]->m_elementIDs[j])
//                                {
//                                    geom = m_hexGeoms[k];
//                                    break;
//                                }
//                            }
//                            ASSERTL0(k != m_hexGeoms.size(),"Failed to find geometry with same global id");
685

686
687
688
689
690
691
                            for(int b = 0; b < 3; ++b)
                            {
                                const LibUtilities::PointsKey pkey(nmodes[cnt+b],pointstype[i][b]);
                                LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey);
                                bkeyvec.push_back(bkey);
                            }
692

693
694
695
696
697
698
699
700
701
702
                            if(!UniOrder)
                            {
                                cnt += 2;
                            }
                        }
                        break;
                    default:
                        ASSERTL0(false,"Need to set up for pyramid and prism 3D Expansions");
                        break;
                    }
703
704
705

                        for(k = 0; k < fields.size(); ++k)
                        {
706
707
708
                            expansionMap = m_expansionMapShPtrMap.find(fields[k])->second;
                            (*expansionMap)[id]->m_geomShPtr = geom;
                            (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
709
                        }
710
711
                }
            }
712

713
        }
714
715


716
717
        // \brief Read will read the meshgraph vertices given a filename.
        void MeshGraph::ReadGeometry(const std::string& infilename)
718
        {
719
720
721
          TiXmlDocument doc(infilename);
          bool loadOkay = doc.LoadFile();

722
723
724
725
726
          std::stringstream errstr;
          errstr << "Unable to load file: " << infilename << " (";
          errstr << doc.ErrorDesc() << ", line " << doc.ErrorRow()
                 << ", column " << doc.ErrorCol() << ")";
          ASSERTL0(loadOkay, errstr.str());
727
728

          ReadGeometry(doc);
729
730
        }

731
732
        // \brief Read will read the meshgraph vertices given a TiXmlDocument.
        void MeshGraph::ReadGeometry(TiXmlDocument &doc)
733
        {
734
735
736
737
            TiXmlHandle docHandle(&doc);
            TiXmlNode* node = NULL;
            TiXmlElement* mesh = NULL;
            TiXmlElement* master = NULL;    // Master tag within which all data is contained.
738

739
            int err;    /// Error value returned by TinyXML.
740

741
742
            master = doc.FirstChildElement("NEKTAR");
            ASSERTL0(master, "Unable to find NEKTAR tag in file.");
743

744
745
            // Find the Mesh tag and same the dim and space attributes
            mesh = master->FirstChildElement("GEOMETRY");
746

747
748
            ASSERTL0(mesh, "Unable to find GEOMETRY tag in file.");
            TiXmlAttribute *attr = mesh->FirstAttribute();
749

750
751
752
            // Initialize the mesh and space dimensions to 3 dimensions.
            // We want to do this each time we read a file, so it should
            // be done here and not just during class initialization.
753
            m_meshPartitioned = false;
754
755
            m_meshDimension = 3;
            m_spaceDimension = 3;
756

757
758
759
760
761
762
763
764
765
766
767
768
769
            while (attr)
            {
                std::string attrName(attr->Name());
                if (attrName == "DIM")
                {
                    err = attr->QueryIntValue(&m_meshDimension);
                    ASSERTL1(err==TIXML_SUCCESS, "Unable to read mesh dimension.");
                }
                else if (attrName == "SPACE")
                {
                    err = attr->QueryIntValue(&m_spaceDimension);
                    ASSERTL1(err==TIXML_SUCCESS, "Unable to read space dimension.");
                }
770
771
772
773
774
775
                else if (attrName == "PARTITION")
                {
                    err = attr->QueryIntValue(&m_partition);
                    ASSERTL1(err==TIXML_SUCCESS, "Unable to read partition.");
                    m_meshPartitioned = true;
                }
776
777
778
779
780
781
                else
                {
                    std::string errstr("Unknown attribute: ");
                    errstr += attrName;
                    ASSERTL1(false, errstr.c_str());
                }
782

783
784
785
                // Get the next attribute.
                attr = attr->Next();
            }
786

787
            ASSERTL1(m_meshDimension<=m_spaceDimension, "Mesh dimension greater than space dimension");
788

789
790
791
            // Now read the vertices
            TiXmlElement* element = mesh->FirstChildElement("VERTEX");
            ASSERTL0(element, "Unable to find mesh VERTEX tag in file.");
792

793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
            NekDouble xscale,yscale,zscale;
            
            // check to see if any scaling parameters are in
            // attributes and determine these values
            LibUtilities::ExpressionEvaluator expEvaluator;
            const char *xscal =  element->Attribute("XSCALE");
            if(!xscal)
            {
                xscale = 1.0;
            }
            else
            {
                std::string xscalstr = xscal;
                expEvaluator.DefineFunction("",xscalstr);
                xscale = expEvaluator.Evaluate();
            }

            const char *yscal =  element->Attribute("YSCALE");
            if(!yscal)
            {
                yscale = 1.0;
            }
            else
            {
                std::string yscalstr = yscal;
                expEvaluator.DefineFunction("",yscalstr);
                yscale = expEvaluator.Evaluate();
            }
                
            const char *zscal = element->Attribute("ZSCALE");
            if(!zscal)
            {
                zscale = 1.0;
            }
            else
            {
                std::string zscalstr = zscal;
                expEvaluator.DefineFunction("",zscalstr);
                zscale = expEvaluator.Evaluate();
            }
            
834
            TiXmlElement *vertex = element->FirstChildElement("V");
835

836
837
            int indx;
            int nextVertexNumber = -1;
838

839
840
841
            while (vertex)
            {
                nextVertexNumber++;
842

843
844
                TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
                std::string attrName(vertexAttr->Name());
845

846
                ASSERTL0(attrName == "ID", (std::string("Unknown attribute name: ") + attrName).c_str());
847

848
849
                err = vertexAttr->QueryIntValue(&indx);
                ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
850
//                ASSERTL0(indx == nextVertexNumber, "Vertex IDs must begin with zero and be sequential.");
851

852
853
                // Now read body of vertex
                std::string vertexBodyStr;
854

855
                TiXmlNode *vertexBody = vertex->FirstChild();
856

857
858
859
860
861
862
863
864
                while (vertexBody)
                {
                    // Accumulate all non-comment body data.
                    if (vertexBody->Type() == TiXmlNode::TEXT)
                    {
                        vertexBodyStr += vertexBody->ToText()->Value();
                        vertexBodyStr += " ";
                    }
865

866
867
                    vertexBody = vertexBody->NextSibling();
                }
868

869
                ASSERTL0(!vertexBodyStr.empty(), "Vertex definitions must contain vertex data.");
870

871
872
873
                // Get vertex data from the data string.
                NekDouble xval, yval, zval;
                std::istringstream vertexDataStrm(vertexBodyStr.c_str());
874

875
876
877
878
879
                try
                {
                    while(!vertexDataStrm.fail())
                    {
                        vertexDataStrm >> xval >> yval >> zval;
880
881
882
883
884
885
886
887
                        
                        xval *= xscale;
                        yval *= yscale;
                        zval *= zscale;
                        
                        // Need to check it here because we may not be
                        // good after the read indicating that there
                        // was nothing to read.
888
889
890
                        if (!vertexDataStrm.fail())
                        {
                            VertexComponentSharedPtr vert(MemoryManager<VertexComponent>::AllocateSharedPtr(m_spaceDimension, indx, xval, yval, zval));
891
                            m_vertSet[indx] = vert;
892
893
894
895
896
897
898
                        }
                    }
                }
                catch(...)
                {
                    ASSERTL0(false, "Unable to read VERTEX data.");
                }
899

900
901
                vertex = vertex->NextSiblingElement("V");
            }
Mike Kirby's avatar
Mike Kirby committed
902
        }
903
904
905


        void MeshGraph::WriteGeometry(const std::string& fileName)
906
        {
907
908
            TiXmlDocument doc(fileName);
            WriteGeometry(doc);
909
        }
910
911

        void MeshGraph::WriteGeometry(TiXmlDocument& doc)
912
913
914
915
        {

        }

916
917
        VertexComponentSharedPtr MeshGraph::AddVertex(NekDouble x, NekDouble y, NekDouble z)
        {
918
            unsigned int nextId = m_vertSet.rbegin()->first + 1;
919
            VertexComponentSharedPtr vert(MemoryManager<VertexComponent>::AllocateSharedPtr(m_spaceDimension, nextId, x, y, z));
920
            m_vertSet[nextId] = vert;
921
922
            return vert;
        }
923

924
925
926
927
928
        SegGeomSharedPtr MeshGraph::AddEdge(VertexComponentSharedPtr v0, VertexComponentSharedPtr v1,
            CurveSharedPtr curveDefinition)
        {
            VertexComponentSharedPtr vertices[] = {v0, v1};
            SegGeomSharedPtr edge;
929
            int edgeId = m_segGeoms.rbegin()->first + 1;
930

931
932
933
934
935
936
937
938
            if( curveDefinition )
            {
                edge = MemoryManager<SegGeom>::AllocateSharedPtr(edgeId, m_spaceDimension, vertices, curveDefinition);
            }
            else
            {
                edge = MemoryManager<SegGeom>::AllocateSharedPtr(edgeId, m_spaceDimension, vertices);
            }
939
            m_segGeoms[edgeId] = edge;
940
941
            return edge;
        }
942

943
        TriGeomSharedPtr MeshGraph::AddTriangle(SegGeomSharedPtr edges[], StdRegions::EdgeOrientation orient[])
Mike Kirby's avatar
Mike Kirby committed
944
        {
945
            int indx = m_triGeoms.rbegin()->first + 1;
946
947
            TriGeomSharedPtr trigeom(MemoryManager<TriGeom>::AllocateSharedPtr(indx, edges, orient));
            trigeom->SetGlobalID(indx);
948

949
            m_triGeoms[indx] = trigeom;
950

951
952
            return trigeom;
        }
953

954
955
        QuadGeomSharedPtr MeshGraph::AddQuadrilateral(SegGeomSharedPtr edges[], StdRegions::EdgeOrientation orient[])
        {
956
            int indx = m_quadGeoms.rbegin()->first + 1;
957
958
            QuadGeomSharedPtr quadgeom(MemoryManager<QuadGeom>::AllocateSharedPtr(indx, edges, orient));
            quadgeom->SetGlobalID(indx);
959

960
            m_quadGeoms[indx] = quadgeom;
961
962
            return quadgeom;
        }
963

964
965
966
967
968
        PrismGeomSharedPtr MeshGraph::AddPrism(TriGeomSharedPtr tfaces[PrismGeom::kNtfaces],
            QuadGeomSharedPtr qfaces[PrismGeom::kNqfaces])
        {
            // Setting the orientation is disabled in the reader.  Why?
            StdRegions::FaceOrientation faceorient[PrismGeom::kNtfaces + PrismGeom::kNqfaces];
969

970
            unsigned int index = m_prismGeoms.rbegin()->first + 1;
971
972
            PrismGeomSharedPtr prismgeom(MemoryManager<PrismGeom>::AllocateSharedPtr(tfaces, qfaces, faceorient));
            prismgeom->SetGlobalID(index);
973

974
            m_prismGeoms[index] = prismgeom;
975
976
            return prismgeom;
        }
977

978
979
        TetGeomSharedPtr MeshGraph::AddTetrahedron(TriGeomSharedPtr tfaces[TetGeom::kNtfaces])
        {
980
            unsigned int index = m_tetGeoms.rbegin()->first + 1;
981
982
            TetGeomSharedPtr tetgeom(MemoryManager<TetGeom>::AllocateSharedPtr(tfaces));
            tetgeom->SetGlobalID(index);
983

984
            m_tetGeoms[index] = tetgeom;
985
986
            return tetgeom;
        }
987

988
989
990
        PyrGeomSharedPtr MeshGraph::AddPyramid(TriGeomSharedPtr tfaces[PyrGeom::kNtfaces],
            QuadGeomSharedPtr qfaces[PyrGeom::kNqfaces])
        {
991
            unsigned int index = m_pyrGeoms.rbegin()->first + 1;
992

993
994
995
            StdRegions::FaceOrientation faceorient[PyrGeom::kNtfaces + PyrGeom::kNqfaces];
            PyrGeomSharedPtr pyrgeom(MemoryManager<PyrGeom>::AllocateSharedPtr(tfaces, qfaces, faceorient));
            pyrgeom->SetGlobalID(index);
996

997
            m_pyrGeoms[index] = pyrgeom;
998
            return pyrgeom;
999
        }
1000

1001
1002
        HexGeomSharedPtr MeshGraph::AddHexahedron(QuadGeomSharedPtr qfaces[HexGeom::kNqfaces])
        {
1003
            unsigned int index = m_hexGeoms.rbegin()->first + 1;
1004
1005
            HexGeomSharedPtr hexgeom(MemoryManager<HexGeom>::AllocateSharedPtr(qfaces));
            hexgeom->SetGlobalID(index);
1006
            m_hexGeoms[index] = hexgeom;
1007
1008
            return hexgeom;
        }
1009

1010
1011
1012
1013
1014
        // \brief Read the expansions given the XML file path.
        void MeshGraph::ReadExpansions(const std::string& infilename)
        {
          TiXmlDocument doc(infilename);
          bool loadOkay = doc.LoadFile();
1015

1016
1017
1018
1019
1020
          std::stringstream errstr;
          errstr << "Unable to load file: " << infilename << std::endl;
          errstr << "Reason: " << doc.ErrorDesc() << std::endl;
          errstr << "Position: Line " << doc.ErrorRow() << ", Column " << doc.ErrorCol() << std::endl;
          ASSERTL0(loadOkay, errstr.str());
1021

1022
1023
          ReadExpansions(doc);
        }
1024

1025
1026
1027
1028
        LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionType(GeometrySharedPtr in,
                                     ExpansionType type,
                                     const int order)
        {
1029
1030
1031
1032
1033
            LibUtilities::BasisKeyVector returnval;
            
            GeomShapeType shape= in->GetGeomShapeType();
            
            switch(type)
1034
            {
1035
					
1036
            case eModified:
1037
			{
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
                switch (shape)
                {
                case eSegment:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                    }
                    break;
                case eQuadrilateral:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                        returnval.push_back(bkey);
                    }
                    break;
                case eHexahedron:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                        returnval.push_back(bkey);
                        returnval.push_back(bkey);
                    }
                    break;
                case eTriangle:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                        
                        const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
                        LibUtilities::BasisKey bkey1(LibUtilities::eModified_B,order,pkey1);
                        
                        returnval.push_back(bkey1);
                    }
                    break;
                case eTetrahedron:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                        
                        const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
                        LibUtilities::BasisKey bkey1(LibUtilities::eModified_B,order,pkey1);
                        returnval.push_back(bkey1);
                        
                        const LibUtilities::PointsKey pkey2(order,LibUtilities::eGaussRadauMAlpha2Beta0);
                        LibUtilities::BasisKey bkey2(LibUtilities::eModified_C,order,pkey2);
                        returnval.push_back(bkey2);
                    }
                    break;
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
                case ePrism:
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eModified_A,order,pkey);
                        returnval.push_back(bkey);
                        returnval.push_back(bkey);
                        
                        const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
                        LibUtilities::BasisKey bkey1(LibUtilities::eModified_B,order,pkey1);
                        returnval.push_back(bkey1);
                        
                    }
                    break;
1104
                default:
1105
				{
1106
                    ASSERTL0(false,"Expansion not defined in switch  for this shape");
1107
1108
				}
				break;
1109
                }
1110
1111
1112
1113
			}
			break;
            
			case eGLL_Lagrange:
1114
            {
1115
1116
1117
                
                switch(shape)
                {
1118
					case eSegment:
1119
1120
1121
1122
                    {
                        const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                        LibUtilities::BasisKey bkey(LibUtilities::eGLL_Lagrange,order,pkey);
                        returnval.push_back(bkey);
1123
					}
1124
                    break;
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
                    case eQuadrilateral:
					{
						const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
						LibUtilities::BasisKey bkey(LibUtilities::eGLL_Lagrange,order,pkey);
						returnval.push_back(bkey);
						returnval.push_back(bkey);
					}
					break;
					case eTriangle: // define with corrects points key
						            // and change to Ortho on
                                    // construction
					{
						const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
						LibUtilities::BasisKey bkey(LibUtilities::eGLL_Lagrange,order,pkey);
						returnval.push_back(bkey);
1140
                    
1141
1142
1143
1144
1145
1146
1147
1148
1149
						const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
						LibUtilities::BasisKey bkey1(LibUtilities::eOrtho_B,order,pkey1);
						returnval.push_back(bkey1);
					}
					break;
                    default:
					{
						ASSERTL0(false,"Expansion not defined in switch  for this shape");
					}
1150
1151
                    break;
                }
1152
1153
            }
            break;
1154
1155
1156
            
			case eOrthogonal:
			{
1157
1158
1159
                switch (shape)
                {
                case eSegment:
1160
1161
1162
				{
					const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
					LibUtilities::BasisKey bkey(LibUtilities::eOrtho_A,order,pkey);
1163
                        
1164
1165
1166
					returnval.push_back(bkey);
				}
				break;
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
                case eTriangle:
                {
                    const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                    LibUtilities::BasisKey bkey(LibUtilities::eOrtho_A,order,pkey);
                    
                    returnval.push_back(bkey);
                    
                    const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
                    LibUtilities::BasisKey bkey1(LibUtilities::eOrtho_B,order,pkey1);
                    
                    returnval.push_back(bkey1);
                }
                break;
                case eQuadrilateral:
                {
                    const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                    LibUtilities::BasisKey bkey(LibUtilities::eOrtho_A,order,pkey);
                    
                    returnval.push_back(bkey);
                    returnval.push_back(bkey);
                }
                break;
                case eTetrahedron:
                {
                    const LibUtilities::PointsKey pkey(order+1,LibUtilities::eGaussLobattoLegendre);
                    LibUtilities::BasisKey bkey(LibUtilities::eOrtho_A,order,pkey);
                    
                    returnval.push_back(bkey);
                    
                    const LibUtilities::PointsKey pkey1(order,LibUtilities::eGaussRadauMAlpha1Beta0);
                    LibUtilities::BasisKey bkey1(LibUtilities::eOrtho_B,order,pkey1);
                    
                    returnval.push_back(bkey1);
                    
                    const LibUtilities::PointsKey pkey2(order,LibUtilities::eGaussRadauMAlpha2Beta0);
                    LibUtilities::BasisKey bkey2(LibUtilities::eOrtho_C,order,pkey2);
                }
                break;
                default:
1206
				{
1207
                    ASSERTL0(false,"Expansion not defined in switch  for this shape");