/[escript]/trunk/finley/src/FinleyDomain.h
ViewVC logotype

Contents of /trunk/finley/src/FinleyDomain.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 months, 2 weeks ago) by uqaeller
File MIME type: text/plain
File size: 32548 byte(s)
Updated the copyright header.


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17
18 #ifndef __FINLEY_DOMAIN_H__
19 #define __FINLEY_DOMAIN_H__
20
21 /****************************************************************************
22
23 Finley: Domain
24
25 A mesh is built from nodes and elements which describe the domain, surface,
26 and point sources (the latter are needed to establish links with other
27 codes, in particular particle codes). The nodes are stored in a NodeFile
28 and elements in ElementFiles. Finley domains have four ElementFiles
29 containing the elements, surface, contact and point sources, respectively.
30 Notice that the surface elements do not necessarily cover the entire
31 surface of the domain.
32
33 The element type is fixed by the reference element, see ReferenceElement.h.
34 The numbering of the nodes starts with 0.
35
36 Important: it is assumed that every node appears in at least one element or
37 surface element and that any node used in an element, surface element or as
38 a point is specified in the NodeFile, see also resolveNodeIds.
39
40 In some cases it is useful to refer to a mesh entirely built from
41 order 1 (=linear) elements. The linear version of the mesh can be
42 accessed by referring to the first few nodes of each element
43 (thanks to the way the nodes are ordered). As the numbering of
44 these nodes is not continuous a relabeling vector is introduced
45 in the NodeFile. This feature is not fully implemented yet.
46
47 All nodes and elements are tagged. The tag allows to group nodes and
48 elements. A typical application is to mark surface elements on a
49 certain portion of the domain with the same tag. All these surface
50 elements can then be assigned the same value e.g. for the pressure.
51
52 The spatial dimensionality is determined by the type of elements
53 used and can be queried using getDim(). Notice that the element type
54 also determines the type of surface elements to be used.
55
56 *****************************************************************************/
57
58 #include <finley/Finley.h>
59 #include <finley/ElementFile.h>
60 #include <finley/NodeFile.h>
61 #include <finley/Util.h>
62
63 #include <escript/AbstractContinuousDomain.h>
64 #include <escript/FunctionSpace.h>
65 #include <escript/FunctionSpaceFactory.h>
66
67 #ifdef ESYS_HAVE_PASO
68 #include <paso/SystemMatrixPattern.h>
69 #endif
70 #ifdef ESYS_HAVE_TRILINOS
71 #include <trilinoswrap/types.h>
72 #endif
73
74 #include <map>
75 #include <string>
76 #include <vector>
77
78 namespace finley {
79
80 typedef std::map<std::string, int> TagMap;
81
82 enum SystemMatrixType {
83 SMT_PASO = 1<<8,
84 SMT_TRILINOS = 1<<10,
85 SMT_COMPLEX = 1<<16,
86 SMT_UNROLL = 1<<17
87 };
88
89 /**
90 \brief
91 FinleyDomain implements the AbstractContinuousDomain interface for the
92 Finley library.
93 */
94 class FinleyDomain : public escript::AbstractContinuousDomain
95 {
96 public:
97 /**
98 \brief
99 recovers domain from a dump file
100 \param filename the name of the file
101 */
102 static escript::Domain_ptr load(const std::string& filename);
103
104 /**
105 \brief
106 reads a mesh from a fly file. For MPI parallel runs fans out the mesh
107 to multiple processes.
108 \param mpiInfo the MPI information structure
109 \param fileName the name of the file
110 \param integrationOrder order of the quadrature scheme.
111 If <0 the order is selected automatically.
112 \param reducedIntegrationOrder order of the reduced quadrature scheme.
113 If <0 the order is selected automatically.
114 \param optimize whether to optimize the node labels
115 */
116 static escript::Domain_ptr read(escript::JMPI mpiInfo,
117 const std::string& fileName,
118 int integrationOrder = -1,
119 int reducedIntegrationOrder = -1,
120 bool optimize = false);
121
122 /**
123 \brief
124 reads a gmsh mesh file.
125 \param mpiInfo the MPI information structure
126 \param filename the name of the gmsh file
127 \param numDim spatial dimensionality
128 \param integrationOrder order of the quadrature scheme.
129 If <0 the order is selected automatically.
130 \param reducedIntegrationOrder order of the reduced quadrature scheme.
131 If <0 the order is selected automatically.
132 \param optimize whether to optimize the node labels
133 \param useMacroElements whether to use first order macro elements
134 */
135 static escript::Domain_ptr readGmsh(escript::JMPI mpiInfo,
136 const std::string& filename,
137 int numDim, int integrationOrder = -1,
138 int reducedIntegrationOrder = -1,
139 bool optimize = false,
140 bool useMacroElements = false);
141
142 /**
143 \brief
144 Creates a 2-dimensional rectangular domain with first order (Rec4)
145 elements in the rectangle [0,L0] x [0,L1].
146
147 \param NE0 Input - number of elements in first dimension
148 \param NE1 Input - number of elements in second dimension
149 \param l0 Input - length of domain in first dimension (width)
150 \param l1 Input - length of domain in second dimension (height)
151 \param periodic0 Input - use periodic boundary in first dimension?
152 \param periodic1 Input - use periodic boundary in second dimension?
153 \param order Input - accuracy of integration scheme (order 1 or 2)
154 \param reducedOrder Input - reduced integration order (1 or 2)
155 \param useElementsOnFace Input - whether to use rich face elements
156 \param optimize Input - whether to optimize node/DOF labelling
157 \param jmpi Input - Shared pointer to MPI Information to be used
158 */
159 static escript::Domain_ptr createRec4(dim_t NE0, dim_t NE1,
160 double L0, double L1,
161 bool periodic0, bool periodic1, int order,
162 int reducedOrder, bool useElementsOnFace,
163 bool optimize, escript::JMPI jmpi);
164
165 /**
166 \brief
167 Creates a 2-dimensional rectangular domain with second order (Rec8 or
168 Rec9) elements in the rectangle [0,L0] x [0,L1].
169
170 \param NE0 Input - number of elements in first dimension
171 \param NE1 Input - number of elements in second dimension
172 \param l0 Input - length of domain in first dimension (width)
173 \param l1 Input - length of domain in second dimension (height)
174 \param periodic0 Input - use periodic boundary in first dimension?
175 \param periodic1 Input - use periodic boundary in second dimension?
176 \param order Input - accuracy of integration scheme (order 1 or 2)
177 \param reducedOrder Input - reduced integration order (1 or 2)
178 \param useElementsOnFace Input - whether to use rich face elements
179 \param useFullElementOrder Input - if true the main element type will
180 be Rec9
181 \param useMacroElements Input - whether to use Macro element type
182 \param optimize Input - whether to optimize node/DOF labelling
183 \param jmpi Input - Shared pointer to MPI Information to be used
184 */
185 static escript::Domain_ptr createRec8(dim_t NE0, dim_t NE1,
186 double l0, double l1,
187 bool periodic0, bool periodic1, int order,
188 int reducedOrder, bool useElementsOnFace,
189 bool useFullElementOrder,
190 bool useMacroElements, bool optimize,
191 escript::JMPI jmpi);
192
193 /**
194 \brief
195 Creates a 3-dimensional rectangular domain with first order (Hex8)
196 elements.
197
198 \param NE0 Input - number of elements in first dimension
199 \param NE1 Input - number of elements in second dimension
200 \param NE2 Input - number of elements in third dimension
201 \param l0 Input - length of domain in first dimension (width)
202 \param l1 Input - length of domain in second dimension (height)
203 \param l2 Input - length of domain in third dimension (depth)
204 \param periodic0 Input - use periodic boundary in first dimension?
205 \param periodic1 Input - use periodic boundary in second dimension?
206 \param periodic2 Input - use periodic boundary in third dimension?
207 \param order Input - integration order (1 or 2)
208 \param reducedOrder Input - reduced integration order (1 or 2)
209 \param useElementsOnFace Input - whether to use rich face elements
210 \param optimize Input - whether to optimize node/DOF labelling
211 \param jmpi Input - Shared pointer to MPI Information to be used
212 */
213 static escript::Domain_ptr createHex8(dim_t NE0, dim_t NE1, dim_t NE2,
214 double l0, double l1, double l2,
215 bool periodic0, bool periodic1, bool periodic2,
216 int order, int reducedOrder,
217 bool useElementsOnFace,
218 bool optimize, escript::JMPI jmpi);
219
220 /**
221 \brief
222 Creates a 3-dimensional rectangular domain with second order (Hex20 or
223 Hex27) elements.
224
225 \param NE0 Input - number of elements in first dimension
226 \param NE1 Input - number of elements in second dimension
227 \param NE2 Input - number of elements in third dimension
228 \param l0 Input - length of domain in first dimension (width)
229 \param l1 Input - length of domain in second dimension (height)
230 \param l2 Input - length of domain in third dimension (depth)
231 \param periodic0 Input - use periodic boundary in first dimension?
232 \param periodic1 Input - use periodic boundary in second dimension?
233 \param periodic2 Input - use periodic boundary in third dimension?
234 \param order Input - integration order (1 or 2)
235 \param reducedOrder Input - reduced integration order (1 or 2)
236 \param useElementsOnFace Input - whether to use rich face elements
237 \param useFullElementOrder Input - ignored
238 \param useMacroElements Input - whether to use Macro element type
239 \param optimize Input - whether to optimize node/DOF labelling
240 \param jmpi Input - Shared pointer to MPI Information to be used
241 */
242 static escript::Domain_ptr createHex20(dim_t NE0, dim_t NE1, dim_t NE2,
243 double l0, double l1, double l2,
244 bool periodic0, bool periodic1, bool periodic2,
245 int order, int reducedOrder,
246 bool useElementsOnFace,
247 bool useFullElementOrder,
248 bool useMacroElements, bool optimize,
249 escript::JMPI jmpi);
250
251 /**
252 \brief
253 Constructor for FinleyDomain
254
255 \param name a descriptive name for the domain
256 \param numDim dimensionality of the domain (2 or 3)
257 \param jmpi shared pointer to MPI Information to be used
258 */
259 FinleyDomain(const std::string& name, int numDim, escript::JMPI jmpi);
260
261 /**
262 \brief
263 Copy constructor.
264 */
265 FinleyDomain(const FinleyDomain& in);
266
267 /**
268 \brief
269 Destructor for FinleyDomain
270 */
271 ~FinleyDomain();
272
273 /**
274 \brief adds Dirac delta points.
275 Do NOT call this at any time other than construction!
276 Using them later creates consistency problems
277 */
278 void addDiracPoints(const std::vector<double>& points,
279 const std::vector<int>& tags);
280
281 /**
282 \brief
283 returns a pointer to this domain's node file
284 */
285 NodeFile* getNodes() const { return m_nodes; }
286
287 /**
288 \brief
289 replaces the element file by `elements`
290 */
291 void setElements(ElementFile* elements);
292
293 /**
294 \brief
295 returns a pointer to this domain's element file
296 */
297 ElementFile* getElements() const { return m_elements; }
298
299 /**
300 \brief
301 replaces the face element file by `elements`
302 */
303 void setFaceElements(ElementFile* elements);
304
305 /**
306 \brief
307 returns a pointer to this domain's face element file
308 */
309 ElementFile* getFaceElements() const { return m_faceElements; }
310
311 /**
312 \brief
313 replaces the contact element file by `elements`
314 */
315 void setContactElements(ElementFile* elements);
316
317 /**
318 \brief
319 returns a pointer to this domain's contact element file
320 */
321 ElementFile* getContactElements() const { return m_contactElements; }
322
323 /**
324 \brief
325 replaces the point element file by `elements`
326 */
327 void setPoints(ElementFile* elements);
328
329 /**
330 \brief
331 returns a pointer to this domain's point (nodal) element file
332 */
333 ElementFile* getPoints() const { return m_points; }
334
335 /**
336 \brief
337 returns a reference to the MPI information wrapper for this domain
338 */
339 virtual escript::JMPI getMPI() const { return m_mpiInfo; }
340
341 /**
342 \brief
343 returns the number of processors used for this domain
344 */
345 virtual int getMPISize() const { return m_mpiInfo->size; }
346
347 /**
348 \brief
349 returns the number MPI rank of this processor
350 */
351 virtual int getMPIRank() const { return m_mpiInfo->rank; }
352
353 /**
354 \brief
355 If compiled for MPI then execute an MPI_Barrier, else do nothing
356 */
357 virtual void MPIBarrier() const;
358
359 /**
360 \brief
361 returns true if on MPI processor 0, else false
362 */
363 virtual bool onMasterProcessor() const { return getMPIRank() == 0; }
364
365 MPI_Comm getMPIComm() const { return m_mpiInfo->comm; }
366
367 /**
368 \brief
369 writes the current mesh to a file with the given name in the fly file
370 format.
371 \param fileName Input - The name of the file to write to.
372 */
373 void write(const std::string& fileName) const;
374
375 /**
376 \brief
377 \param full whether to include coordinate values and id's
378 */
379 void Print_Mesh_Info(bool full=false) const;
380
381 /**
382 \brief
383 dumps the mesh to a file with the given name.
384 \param fileName Input - The name of the file
385 */
386 void dump(const std::string& fileName) const;
387
388 /**
389 \brief
390 Return the tag key for the given sample number.
391 \param functionSpaceType Input - The function space type.
392 \param sampleNo Input - The sample number.
393 */
394 int getTagFromSampleNo(int functionSpaceType, index_t sampleNo) const;
395
396 /**
397 \brief
398 Return the reference number of the given sample number.
399 \param functionSpaceType Input - The function space type.
400 */
401 const index_t* borrowSampleReferenceIDs(int functionSpaceType) const;
402
403 /**
404 \brief
405 Returns true if the given integer is a valid function space type
406 for this domain.
407 */
408 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
409
410 /**
411 \brief
412 Return a description for this domain
413 */
414 virtual std::string getDescription() const;
415
416 /**
417 \brief
418 Return a description for the given function space type code
419 */
420 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
421
422 /**
423 \brief
424 Build the table of function space type names
425 */
426 void setFunctionSpaceTypeNames();
427
428 /**
429 \brief
430 Return a continuous FunctionSpace code
431 */
432 virtual int getContinuousFunctionCode() const;
433
434 /**
435 \brief
436 Return a continuous on reduced order nodes FunctionSpace code
437 */
438 virtual int getReducedContinuousFunctionCode() const;
439
440 /**
441 \brief
442 Return a function FunctionSpace code
443 */
444 virtual int getFunctionCode() const;
445
446 /**
447 \brief
448 Return a function with reduced integration order FunctionSpace code
449 */
450 virtual int getReducedFunctionCode() const;
451
452 /**
453 \brief
454 Return a function on boundary FunctionSpace code
455 */
456 virtual int getFunctionOnBoundaryCode() const;
457
458 /**
459 \brief
460 Return a function on boundary with reduced integration order FunctionSpace code
461 */
462 virtual int getReducedFunctionOnBoundaryCode() const;
463
464 /**
465 \brief
466 Return a FunctionOnContactZero code
467 */
468 virtual int getFunctionOnContactZeroCode() const;
469
470 /**
471 \brief
472 Return a FunctionOnContactZero code with reduced integration order
473 */
474 virtual int getReducedFunctionOnContactZeroCode() const;
475
476 /**
477 \brief
478 Return a FunctionOnContactOne code
479 */
480 virtual int getFunctionOnContactOneCode() const;
481
482 /**
483 \brief
484 Return a FunctionOnContactOne code with reduced integration order
485 */
486 virtual int getReducedFunctionOnContactOneCode() const;
487
488 /**
489 \brief
490 Return a Solution code
491 */
492 virtual int getSolutionCode() const;
493
494 /**
495 \brief
496 Return a ReducedSolution code
497 */
498 virtual int getReducedSolutionCode() const;
499
500 /**
501 \brief
502 Return a DiracDeltaFunctions code
503 */
504 virtual int getDiracDeltaFunctionsCode() const;
505
506 /**
507 \brief
508 */
509 typedef std::map<int, std::string> FunctionSpaceNamesMapType;
510
511 /**
512 \brief returns the dimensionality of this domain
513 */
514 virtual int getDim() const { return m_nodes->numDim; }
515
516 /**
517 \brief
518 Returns a status indicator of the domain. The status identifier should be unique over
519 the live time if the object but may be updated if changes to the domain happen, e.g.
520 modifications to its geometry.
521 */
522 virtual StatusType getStatus() const;
523
524 /**
525 \brief
526 Return the number of data points summed across all MPI processes
527 */
528 virtual dim_t getNumDataPointsGlobal() const;
529
530 /**
531 \brief
532 Return the number of data points per sample, and the number of samples as a pair.
533 \param functionSpaceCode Input -
534 */
535 virtual std::pair<int,dim_t> getDataShape(int functionSpaceCode) const;
536
537 /**
538 \brief
539 copies the location of data points into arg. The domain of arg has to match this.
540 has to be implemented by the actual Domain adapter.
541 */
542 virtual void setToX(escript::Data& arg) const;
543
544 /**
545 \brief
546 sets a map from a clear tag name to a tag key
547 \param name Input - tag name.
548 \param tag Input - tag key.
549 */
550 virtual void setTagMap(const std::string& name, int tag);
551
552 /**
553 \brief
554 Return the tag key for tag name.
555 \param name Input - tag name
556 */
557 virtual int getTag(const std::string& name) const;
558
559 /**
560 \brief
561 Returns true if name is a defined tag name.
562 \param name Input - tag name to be checked.
563 */
564 virtual bool isValidTagName(const std::string& name) const;
565
566 /**
567 \brief
568 Returns all tag names in a single string sperated by commas
569 */
570 virtual std::string showTagNames() const;
571
572 /**
573 \brief
574 assigns new location to the domain
575 */
576 virtual void setNewX(const escript::Data& arg);
577
578 /**
579 \brief
580 interpolates data given on source onto target where source and target have to be given on the same domain.
581 */
582 virtual void interpolateOnDomain(escript::Data& target,
583 const escript::Data& source) const;
584
585 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,
586 int functionSpaceType_target) const;
587
588 virtual signed char preferredInterpolationOnDomain(int functionSpaceType_source, int functionSpaceType_target) const;
589
590 /**
591 \brief given a vector of FunctionSpace typecodes, pass back a code which then can all be interpolated to.
592 \return true is result is valid, false if not
593 */
594 bool commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const;
595
596 /**
597 \brief
598 interpolates data given on source onto target where source and target are given on different domains.
599 */
600 virtual void interpolateAcross(escript::Data& target, const escript::Data& source) const;
601
602 /**
603 \brief determines whether interpolation from source to target is possible.
604 */
605 virtual bool probeInterpolationAcross(int functionSpaceType_source,
606 const escript::AbstractDomain& targetDomain,
607 int functionSpaceType_target) const;
608
609 /**
610 \brief
611 copies the surface normals at data points into out. The actual function space to be considered
612 is defined by out. out has to be defined on this.
613 */
614 virtual void setToNormal(escript::Data& out) const;
615
616 /**
617 \brief
618 copies the size of samples into out. The actual function space to be considered
619 is defined by out. out has to be defined on this.
620 */
621 virtual void setToSize(escript::Data& out) const;
622
623 /**
624 \brief
625 copies the gradient of arg into grad. The actual function space to be considered
626 for the gradient is defined by grad. arg and grad have to be defined on this.
627 */
628 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
629
630 /**
631 \brief
632 copies the integrals of the function defined by arg into integrals.
633 arg has to be defined on this.
634 */
635 virtual void setToIntegrals(std::vector<escript::DataTypes::real_t>& integrals,
636 const escript::Data& arg) const;
637 virtual void setToIntegrals(std::vector<escript::DataTypes::cplx_t>& integrals,
638 const escript::Data& arg) const;
639
640 /**
641 \brief
642 return the identifier of the matrix type to be used for the global
643 stiffness matrix when a particular solver, package, preconditioner,
644 and symmetric matrix is used.
645
646 \param options a SolverBuddy instance with the desired options set
647 */
648 virtual int getSystemMatrixTypeId(const boost::python::object& options) const;
649
650 /**
651 \brief
652 return the identifier of the transport problem type to be used when a particular solver, perconditioner, package
653 and symmetric matrix is used.
654 \param solver
655 \param preconditioner
656 \param package
657 \param symmetry
658 */
659 virtual int getTransportTypeId(int solver, int preconditioner, int package,
660 bool symmetry) const;
661
662 /**
663 \brief
664 returns true if data on this domain and a function space of type functionSpaceCode has to
665 considered as cell centered data.
666 */
667 virtual bool isCellOriented(int functionSpaceCode) const;
668
669 virtual bool ownSample(int fsCode, index_t id) const;
670
671 /**
672 \brief
673 adds a PDE onto the stiffness matrix mat and a rhs
674 */
675 virtual void addPDEToSystem(
676 escript::AbstractSystemMatrix& mat, escript::Data& rhs,
677 const escript::Data& A, const escript::Data& B,
678 const escript::Data& C, const escript::Data& D,
679 const escript::Data& X, const escript::Data& Y,
680 const escript::Data& d, const escript::Data& y,
681 const escript::Data& d_contact,
682 const escript::Data& y_contact,
683 const escript::Data& d_dirac,
684 const escript::Data& y_dirac) const;
685
686 /**
687 \brief
688 adds a PDE onto the lumped stiffness matrix matrix
689 */
690 virtual void addPDEToLumpedSystem(escript::Data& mat,
691 const escript::Data& D,
692 const escript::Data& d,
693 const escript::Data& d_dirac,
694 bool useHRZ) const;
695
696 /**
697 \brief
698 adds a PDE onto the stiffness matrix mat and a rhs
699 */
700 virtual void addPDEToRHS(escript::Data& rhs, const escript::Data& X,
701 const escript::Data& Y, const escript::Data& y,
702 const escript::Data& y_contact,
703 const escript::Data& y_dirac) const;
704
705 /**
706 \brief
707 adds a PDE onto a transport problem
708 */
709 virtual void addPDEToTransportProblem(
710 escript::AbstractTransportProblem& tp,
711 escript::Data& source, const escript::Data& M,
712 const escript::Data& A, const escript::Data& B,
713 const escript::Data& C, const escript::Data& D,
714 const escript::Data& X, const escript::Data& Y,
715 const escript::Data& d, const escript::Data& y,
716 const escript::Data& d_contact,
717 const escript::Data& y_contact,
718 const escript::Data& d_dirac,
719 const escript::Data& y_dirac) const;
720
721 /**
722 \brief
723 creates a stiffness matrix and initializes it with zeros
724 */
725 escript::ASM_ptr newSystemMatrix(
726 int row_blocksize,
727 const escript::FunctionSpace& row_functionspace,
728 int column_blocksize,
729 const escript::FunctionSpace& column_functionspace,
730 int type) const;
731
732 /**
733 \brief
734 creates a TransportProblem
735 */
736 escript::ATP_ptr newTransportProblem(int blocksize,
737 const escript::FunctionSpace& functionspace,
738 int type) const;
739
740 /**
741 \brief returns locations in the FEM nodes
742 */
743 virtual escript::Data getX() const;
744
745 #ifdef ESYS_HAVE_BOOST_NUMPY
746 /**
747 \brief returns locations in the FEM nodes as a numpy ndarray
748 */
749 virtual boost::python::numpy::ndarray getNumpyX() const;
750
751 /**
752 \brief returns connectivity information as a numpy ndarray
753 */
754 virtual boost::python::numpy::ndarray getConnectivityInfo() const;
755 #endif
756
757 /**
758 \brief returns the VTK element type
759 */
760 virtual int getVTKElementType() const;
761
762 /**
763 \brief returns boundary normals at the quadrature point on the face
764 elements
765 */
766 virtual escript::Data getNormal() const;
767
768 /**
769 \brief returns the element size
770 */
771 virtual escript::Data getSize() const;
772
773 /**
774 \brief comparison operators
775 */
776 virtual bool operator==(const escript::AbstractDomain& other) const;
777 virtual bool operator!=(const escript::AbstractDomain& other) const;
778
779 /**
780 \brief assigns new tag newTag to all samples of functionspace with a
781 positive value of mask for any its sample point.
782 */
783 virtual void setTags(int functionSpaceType, int newTag,
784 const escript::Data& mask) const;
785
786 /**
787 \brief
788 returns the number of tags in use and a pointer to an array with the
789 number of tags in use
790 */
791 virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
792
793 virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
794
795 /**
796 \brief Checks if this domain allows tags for the specified
797 functionSpace code.
798 */
799 virtual bool canTag(int functionSpaceCode) const;
800
801 /**
802 \brief returns the approximation order used for a function space functionSpaceCode
803 */
804 virtual int getApproximationOrder(int functionSpaceCode) const;
805
806 virtual bool supportsContactElements() const { return true; }
807
808 virtual escript::Data randomFill(const escript::DataTypes::ShapeType& shape,
809 const escript::FunctionSpace& what, long seed,
810 const boost::python::tuple& filter) const;
811
812 /**
813 \brief
814 returns a reference to the tag name->value map
815 */
816 const TagMap& getTagMap() const { return m_tagMap; }
817
818 void createMappings(const IndexVector& dofDistribution,
819 const IndexVector& nodeDistribution);
820
821 #ifdef ESYS_HAVE_PASO
822 /// returns a reference to the paso matrix pattern
823 paso::SystemMatrixPattern_ptr getPasoPattern(bool reducedRowOrder,
824 bool reducedColOrder) const;
825 #endif
826
827 #ifdef ESYS_HAVE_TRILINOS
828 /// returns a Trilinos CRS graph suitable to build a sparse matrix.
829 esys_trilinos::const_TrilinosGraph_ptr getTrilinosGraph(bool reducedOrder) const;
830 #endif
831
832 void glueFaces(double safetyFactor, double tolerance, bool optimize);
833
834 void joinFaces(double safetyFactor, double tolerance, bool optimize);
835
836 /// takes nodes, elements, etc. of all input meshes and copies them into
837 /// a new mesh. Ids of output are shifted by the maximum Id of inputs.
838 static FinleyDomain* merge(const std::vector<const FinleyDomain*>& meshes);
839
840 private:
841 void prepare(bool optimize);
842
843 void setOrders();
844
845 /// Initially the element nodes refer to the numbering defined by the
846 /// global id assigned to the nodes in the NodeFile. It is also not ensured
847 /// that all nodes referred by an element are actually available on the
848 /// process. At the output, a local node labeling is used and all nodes are
849 /// available. In particular the numbering of the element nodes is between
850 /// 0 and Nodes->numNodes.
851 /// The function does not create a distribution of the degrees of freedom.
852 void resolveNodeIds();
853
854 /// assigns new node reference numbers to all element files.
855 /// If k is the old node, the new node is newNode[k-offset].
856 void relabelElementNodes(const IndexVector& newNode, index_t offset);
857
858 template<typename Scalar>
859 void setToIntegralsWorker(std::vector<Scalar>& integrals,
860 const escript::Data& arg) const;
861
862 #ifdef ESYS_HAVE_PASO
863 paso::SystemMatrixPattern_ptr makePasoPattern(bool reducedRowOrder,
864 bool reducedColOrder) const;
865 #endif
866 #ifdef ESYS_HAVE_TRILINOS
867 esys_trilinos::GraphType* createTrilinosGraph(bool reducedOrder) const;
868 #endif
869 void createColoring(const IndexVector& dofMap);
870 void distributeByRankOfDOF(const IndexVector& distribution);
871 void markNodes(std::vector<short>& mask, index_t offset, bool useLinear) const;
872 void optimizeDOFDistribution(IndexVector& distribution);
873 void optimizeDOFLabeling(const IndexVector& distribution);
874 void optimizeElementOrdering();
875 void findMatchingFaces(double safetyFactor, double tolerance, int* numPairs,
876 int* elem0, int* elem1, int* matchingNodes) const;
877 void updateTagList();
878 void printElementInfo(const ElementFile* e, const std::string& title,
879 const std::string& defaultType, bool full) const;
880
881 void writeElementInfo(std::ostream& stream, const ElementFile* e,
882 const std::string& defaultType) const;
883
884 /// MPI information
885 escript::JMPI m_mpiInfo;
886 /// domain description
887 std::string m_name;
888 int approximationOrder;
889 int reducedApproximationOrder;
890 int integrationOrder;
891 int reducedIntegrationOrder;
892 /// the table of the nodes
893 NodeFile* m_nodes;
894 /// the table of the elements
895 ElementFile* m_elements;
896 /// the table of face elements
897 ElementFile* m_faceElements;
898 /// the table of contact elements
899 ElementFile* m_contactElements;
900 /// the table of points (treated as elements of dimension 0)
901 ElementFile* m_points;
902 /// the tag map mapping names to tag keys
903 TagMap m_tagMap;
904 #ifdef ESYS_HAVE_PASO
905 // pointer to the sparse matrix patterns
906 mutable paso::SystemMatrixPattern_ptr FullFullPattern;
907 mutable paso::SystemMatrixPattern_ptr FullReducedPattern;
908 mutable paso::SystemMatrixPattern_ptr ReducedFullPattern;
909 mutable paso::SystemMatrixPattern_ptr ReducedReducedPattern;
910 #endif
911 #ifdef ESYS_HAVE_TRILINOS
912 mutable esys_trilinos::TrilinosGraph_ptr m_fullGraph;
913 mutable esys_trilinos::TrilinosGraph_ptr m_reducedGraph;
914 #endif
915
916 static FunctionSpaceNamesMapType m_functionSpaceTypeNames;
917 };
918
919 } // end of namespace
920
921 #endif // __FINLEY_DOMAIN_H__
922

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26