hp2FEM  0.1
include/solvercontrol/PartitionData.h
00001 #ifndef _PARTITIONDATA_H_
00002 #define _PARTITIONDATA_H_
00003 // ---------------------------------------------
00004 // company   : 
00005 // user      : 
00006 // date      : 22 Mar 2015 17:25
00007 // file      : PartitionData.h
00008 // markers   : Full
00009 // language  : C++
00010 // generator : Metamill 6.0
00011 // ---------------------------------------------
00012 
00013 //#UBLK-BEG-HEADERH
00014 //#UBLK-END-HEADERH
00015 
00016 /*=================================================================================================
00017 =                                                                                                 =
00018 =       Copyright 2010-2015  Marco Lucio Bittencourt / Fabiano Fernandes Bargos                       =
00019 =                        Gilberto Luis Valente / Jorge Luis Suzuki / Allan Patrick Cordeiro Dias  =
00020 =                                                                                                 =
00021 =       Licensed under the Apache License, Version 2.0 (the "License");                               =
00022 =       you may not use this file except in compliance with the License.                              =
00023 =       You may obtain a copy of the License at                                                       =
00024 =                                                                                                 =
00025 =               http://www.apache.org/licenses/LICENSE-2.0                                                =
00026 =                                                                                                 =
00027 =       Unless required by applicable law or agreed to in writing, software                           =
00028 =       distributed under the License is distributed on an "AS IS" BASIS,                             =
00029 =       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                      =
00030 =       See the License for the specific language governing permissions and                           =
00031 =       limitations under the License.                                                                =
00032 =                                                                                                 =
00033 =================================================================================================*/
00034 
00035 
00036 typedef struct LocalVariablesSize {
00037         unsigned long long IncidOffset;
00038         unsigned long long ElemTopologicalIndices_BoundElem;
00039         unsigned long long GlobalElemIncid_Shared;
00040         unsigned long long GlobalToLocalMapNeighbors;
00041         unsigned long long GlobalToLocalMap;
00042         unsigned long long GlobalIncidForNeighbors;
00043 
00044         unsigned long long BoundaryElementsAdjTmp;
00045         unsigned long long OverlappingElementsSets;
00046         unsigned long long ElemTopologicalIndices_BoundAdj;
00047     unsigned long long GlobalElemIncid_Shared2;
00048         unsigned long long CountMaxBoundAdjacentIncidences;
00049 };
00050 
00051 
00052 
00053 #include "ds/Array.h"
00054 #include "fegroups/FEGroups.h"
00055 #include "model/Model.h"
00056 #include "metis.h"
00057 
00058 
00062 class PartitionData
00063 {
00064 //#UBLK-BEG-CLASSDEF mm:977628e7-db77-4580-b515-1de5ae80d95f
00065 //#UBLK-END-CLASSDEF
00066 
00067  public:
00068 
00069    // METHOD=mm:68c35b66-3519-4957-8443-9a7b5b5678f2
00070    PartitionData();
00071 
00072    // METHOD=mm:8fbfc04e-8100-4f76-b085-976ef4887653
00073    void Partitioner(Model& GlobalModel);
00074 
00075    // METHOD=mm:46840fa5-4aa9-4443-9a28-329200a0e69e
00076    void Partitioner(long* ElemPartitions, PartitionData& ParData);
00077 
00078    // METHOD=mm:03964062-6fd7-4d37-abb8-5df12843edd4
00079    PartitionData operator=(PartitionData& Instance);
00080 
00081    // METHOD=mm:fa7753cd-882d-40d5-b243-659fd981e2f3
00082    void Print(FILE* File, char* Message = (char*)"");
00083 
00084    // METHOD=mm:5a2abc37-27ed-4257-88fb-dac2d6e60bcb
00085    ~PartitionData();
00086 
00087    // METHOD=mm:5993b923-211d-4c9d-95da-7b46afe7baa7
00088    void Free();
00089 
00090 
00094    // attr=mm:3df10c8c-b5af-4a43-8471-3c3642f32f3d
00095    long ID;
00096 
00100    // attr=mm:0968804c-37b5-484d-a37b-b15c9cec8c16
00101    int MinimumID;
00102 
00106    // attr=mm:369f9465-7e4d-4eaf-8ab8-619dc056a57c
00107    BuiltInArray<bool>  PartitionsToBePerformed;
00108 
00117    // attr=mm:09841146-c863-4372-b835-2203384900f8
00118    OneIndexTable<long> AdjacentsInfo;
00119 
00123    // attr=mm:6a3df6a0-a526-413e-9abc-640baa35a7ab
00124    BuiltInArray<long> LocalElements;
00125 
00131    // attr=mm:b483230f-b559-44ee-a888-656e46c164b3
00132    BuiltInArray<long> GlobalElementsMap;
00133 
00139    // attr=mm:fa55aaed-054d-43ce-83e4-f51855f258ed
00140    OneIndexTable<long> LocalIncidences;
00141 
00146    // attr=mm:1a727b50-4805-4a44-865c-0efbcaa8385e
00147    BuiltInArray<long> LocalToGlobalIncidencesMap;
00148 
00153    // attr=mm:6721a4f0-c275-4c33-a9c9-131e2f5420db
00154    OneIndexTable<long> LocalIncidForNeighbors;
00155 
00159    // attr=mm:2eb4ccd9-f66f-4182-82f6-84c028dbaec6
00160    BuiltInArray<long> BoundaryElements;
00161 
00171    // attr=mm:7ac39af8-e07a-4428-b143-9bb64403254e
00172    OneIndexTable<long> BoundaryElementsInfo;
00173 
00177    // attr=mm:df7ecec6-5065-481b-baf0-97ac882e5973
00178    OneIndexTable<long> BoundaryIncidences;
00179 
00183    // attr=mm:95248483-76fb-49cf-a428-1df806d93b61
00184    BuiltInArray<long> InternalElements;
00185 
00189    // attr=mm:3f222378-30b4-4af6-878d-7e3a0d1a3c5f
00190    OneIndexTable<long> InternalIncidences;
00191 
00195    // attr=mm:aba39bfc-a856-4f89-8fdb-3c3dff5a7add
00196    BuiltInArray<long> OverlappingElements;
00197 
00201    // attr=mm:14705c62-7a81-4f65-8b3c-79da97817c62
00202    OneIndexTable<long> OverlappingElemIncidences;
00203 
00207    // attr=mm:c9996667-b616-48bc-9b29-f8b3dfb2d262
00208    OneIndexTable<long> OverlappingElemTopoIndices;
00209 
00213    // attr=mm:3eba330c-ae5c-4496-a19a-ed2c15fdf44e
00214    BuiltInArray<long> NeighborsPartitions;
00215 
00219    // attr=mm:a0be6c0c-ab83-442f-b0b9-d372cfc379fe
00220    BuiltInArray<long> TotalNumVertices;
00221 
00227    // attr=mm:a4d91a42-82c0-4880-8f07-0083848f3828
00228    BuiltInArray<long> PartitionsBoundIncidStartSize;
00229 
00233    // attr=mm:9785e901-e7d0-4d1c-a39d-1ad24fdd1d76
00234    unsigned long NumAdjPartitions;
00235 
00239    // attr=mm:46fd7821-017b-4a29-b494-251da31061d1
00240    unsigned long NumElements;
00241 
00245    // attr=mm:c43859aa-dcf8-4b14-89d2-48f27e085049
00246    unsigned long NumIncidences;
00247 
00251    // attr=mm:d293213b-8663-480a-9b00-d64a8cb6460c
00252    unsigned long NumBoundaryElements;
00253 
00257    // attr=mm:971ab6a1-5a25-4d61-8d45-e1c86406afd8
00258    unsigned long NumInternalElements;
00259 
00263    // attr=mm:49d4fd99-10c2-4120-98c5-d560964c030d
00264    unsigned long NumBoundaryIncidences;
00265 
00269    // attr=mm:c60c9f06-f1b8-4cf1-8ca4-c0226fc9f6fd
00270    unsigned long NumInternalIncidences;
00271 
00272 
00273  protected:
00274 
00275    // METHOD=mm:3630e527-7b46-4914-bf5b-a1e5d91ecc90
00276    void BuildPartitionElements(int Rank, int NumGlobalElems, BuiltInArray<int>& xadj, BuiltInArray<int>& adjncy, BuiltInArray<int>& ewgt, BuiltInArray<int>& partition, bool& WithOverlapping);
00277 
00278    // METHOD=mm:b7e02e97-4e47-487b-9d8e-96fe9b9cf813
00279    int BuildPartitionIncidences_StoreSharedLocalOrder(Model& GlobalModel, bool& WithOverlapping, struct LocalVariablesSize& VariablesSize);
00280 
00281    // METHOD=mm:d4903200-30cd-428b-a09d-3e345d44b4af
00282    int BuildPartitionIncidences_StoreSharedGlobalOrder(Model& GlobalModel);
00283 
00284    // METHOD=mm:ab5af31e-ea08-4975-8fce-593d5a63ab2a
00285    int BuildPartitionIncidencesClockwise(Model& GlobalModel);
00286 
00287    // METHOD=mm:f39ea4d9-0af6-4f0b-afc5-0404272bbf8b
00288    int BuildOverlappingPartitionIncidences(Model& GlobalModel, bool& WithOverlapping, struct LocalVariablesSize& VariablesSize);
00289 
00290    // METHOD=mm:98a55235-1ddd-415a-bb52-1f3575b1a58a
00291    int BuildOverlappingElementsIncidences(Mesh& SolMesh, BuiltInArray<long>& GlobalToLocalMap, struct LocalVariablesSize& VariablesSize);
00292 
00293    // METHOD=mm:f017dd21-b8ac-4a67-9680-77b47c185234
00294    void NumberingBoundaryIncidenceClockWise(ElementElementTable& ElemElemTable, Mesh& SolMesh, BuiltInArray<long>& GlobalIncidMapTmp, unsigned long FirstBoundaryElem, unsigned long FirstBoundaryElemInd, unsigned long FirstBoundaryEdge, unsigned long& NextBoundaryEdge, unsigned long& NextBoundary, unsigned long& LastBoundaryIncid);
00295 
00296    // METHOD=mm:f59be797-8234-4595-985c-cf6c6f0ef776
00297    void BuildLocalIncidForNeighbors(OneIndexTable<long>& GlobalIncidForNeighbors, BuiltInArray<long>& GlobalToLocalMap);
00298 
00299    // METHOD=mm:968ccb0e-033d-4ac2-b6e1-fbe88c6b878c
00300    void BuildLocalIncidForNeighbors_MessageExchange(OneIndexTable<long>& GlobalIncidForNeighbors, BuiltInArray<long>& GlobalToLocalMap);
00301 
00302    // METHOD=mm:b8a49b5f-7df4-46bf-8681-636f486da056
00303    void ReinitializesRankTags(int NumRanks, unsigned long NumNeighbors, BuiltInArray<bool>& CheckNeighbors, BuiltInArray<bool>& RanksTag, int& LastRank);
00304 
00305    // METHOD=mm:bc9affbc-ab73-4439-a73d-044ea96c9e98
00306    void SearchFirstPartitionToNumbering(ElementElementTable& ElemElemTable, int& FirstPartition, unsigned long& FirstBoundOut, unsigned long& FirstBoundIndOut, long& FirstEdgeOut);
00307 
00308    // METHOD=mm:1e05ab4b-aa26-4194-b8a6-a8626eb4b98a
00309    void SearchFirstBoundInInternalPartition(ElementElementTable& ElemElemTable, unsigned long& FirstBoundOut, unsigned long& FirstBoundIndOut, long& FirstEdgeOut);
00310 
00311    // METHOD=mm:977bd262-099e-492b-baab-ee1336d8b5b8
00312    void SearchFirstBoundInBoundPartition(ElementElementTable& ElemElemTable, unsigned long& FirstBoundOut, unsigned long& FirstBoundIndOut, long& FirstEdgeOut);
00313 
00314    // METHOD=mm:758588d8-5acd-4f0e-bfe9-b0229e429717
00315    void SetInternalAndBoundaryElements(BuiltInArray<int>& xadj, BuiltInArray<int>& partition, bool& WithOverlapping);
00316 
00317    // METHOD=mm:e6f63eff-f959-4e9e-aed7-476ac6c9487b
00318    void SetInternalAndBoundaryIncidences();
00319 
00320    // METHOD=mm:4a8cee5f-0bc6-4451-9b01-7a86dc187446
00321    void SetBoundaryIncidences();
00322 
00323    // METHOD=mm:9f7aebb5-5002-427c-89f0-ac0d990d7ac6
00324    void SetSizeLocalIncidences(FiniteElementGroup& Group);
00325 
00326    // METHOD=mm:5450b959-3eda-49b0-8baf-59640b117f84
00327    long GetNextPartitionToBeNumbering(unsigned long BoundElem, unsigned long bound_elem_i, unsigned long curr_edge, ElementElementTable& ElemElemTable);
00328 
00329    // METHOD=mm:740c93dc-4485-486e-be35-f30802e8aa64
00330    unsigned long GetNumberSharedVertices(unsigned long NumberVertA, long* ElemA_Incid, unsigned long NumberVertB, long* ElemB_Incid);
00331 
00332    // METHOD=mm:f1e51d8e-cc97-4ef8-9ccf-dd7a84cee831
00333    unsigned long GetSharedGlobalIncidences(unsigned long NumberIncidA, long* ElemA_Incid, unsigned long NumberIncidB, long* ElemB_Incid, unsigned long& NumberSharedIncidence, long* ElemTopologicalIndA, long* SharedIncidences);
00334 
00335    // METHOD=mm:57aa63ec-24a3-43ab-ad75-e195aa3b4bff
00336    void SetMetisAlgorithmOptions(int* options);
00337 
00338 
00339  private:
00340 
00341    // METHOD=mm:a0ced3ea-520f-401e-b8f6-fb134aa4d374
00342    long SearchNeighborsPartitionsIndice(int NeighborID);
00343 
00344    // METHOD=mm:8cb52f55-40be-4f68-a000-6c5ba02057ab
00345    long SearchBoundaryElementIndice(unsigned long BoundElem);
00346 
00347    // METHOD=mm:ab2e50bd-2854-41a5-9d6d-c3c1991bbad5
00348    int SearchPartitionOfNeighbor(long Neighbor, unsigned long LocalElem);
00349 
00350    // METHOD=mm:59851279-37d6-4e36-a6a3-b8811403e481
00351    void PrintSize(struct LocalVariablesSize& VariablesSize);
00352 
00353 
00354 //#UBLK-BEG-CLASSMEMB mm:977628e7-db77-4580-b515-1de5ae80d95f
00355 //#UBLK-END-CLASSMEMB
00356 };
00357 
00358 //#UBLK-BEG-GLOBALH
00359 //#UBLK-END-GLOBALH
00360 
00361 
00362 #endif // _PARTITIONDATA_H_
 All Classes Files Functions Variables Typedefs Friends Defines