1 /*******************************************************************/
2 /*                               XDMF                              */
3 /*                   eXtensible Data Model and Format              */
4 /*                                                                 */
5 /*  Id : Id  */
6 /*  Date : $Date$ */
7 /*  Version : $Revision$ */
8 /*                                                                 */
9 /*  Author:                                                        */
10 /*     Jerry A. Clarke                                             */
11 /*     clarke@arl.army.mil                                         */
12 /*     US Army Research Laboratory                                 */
13 /*     Aberdeen Proving Ground, MD                                 */
14 /*                                                                 */
15 /*     Copyright @ 2002 US Army Research Laboratory                */
16 /*     All Rights Reserved                                         */
17 /*     See Copyright.txt or http://www.arl.hpc.mil/ice for details */
18 /*                                                                 */
19 /*     This software is distributed WITHOUT ANY WARRANTY; without  */
20 /*     even the implied warranty of MERCHANTABILITY or FITNESS     */
21 /*     FOR A PARTICULAR PURPOSE.  See the above copyright notice   */
22 /*     for more information.                                       */
23 /*                                                                 */
24 /*******************************************************************/
25 #include "XdmfDomain.h"
26 #include "XdmfGrid.h"
27 
28 namespace xdmf2
29 {
30 
XdmfDomain()31 XdmfDomain::XdmfDomain() {
32     this->SetElementName("Domain");
33 }
34 
~XdmfDomain()35 XdmfDomain::~XdmfDomain() {
36 }
37 
UpdateInformation()38 XdmfInt32 XdmfDomain::UpdateInformation(){
39 
40     if(XdmfElement::UpdateInformation() != XDMF_SUCCESS) return(XDMF_FAIL);
41     return(XDMF_SUCCESS);
42 }
43 
44 XdmfInt32
Insert(XdmfElement * Child)45 XdmfDomain::Insert( XdmfElement *Child){
46     if(Child && (
47         XDMF_WORD_CMP(Child->GetElementName(), "DataItem") ||
48         XDMF_WORD_CMP(Child->GetElementName(), "Grid") ||
49         XDMF_WORD_CMP(Child->GetElementName(), "Information")
50         )){
51         XdmfInt32 status = XdmfElement::Insert(Child);
52         if((status == XDMF_SUCCESS) && XDMF_WORD_CMP(Child->GetElementName(), "Grid")){
53             XdmfGrid *ChildGrid = (XdmfGrid *)Child;
54             if((ChildGrid->GetGridType() & XDMF_GRID_MASK) == XDMF_GRID_UNIFORM){
55                 if(ChildGrid->InsertTopology() != XDMF_SUCCESS) return(XDMF_FAIL);
56                 if(ChildGrid->InsertGeometry() != XDMF_SUCCESS) return(XDMF_FAIL);
57             }
58         }
59         return(status);
60     }else{
61         XdmfErrorMessage("Domain can only Insert Grid | DataItem | Information elements, not a " << Child->GetElementName());
62     }
63     return(XDMF_FAIL);
64 }
65 
Build()66 XdmfInt32 XdmfDomain::Build(){
67     if(XdmfElement::Build() != XDMF_SUCCESS) return(XDMF_FAIL);
68     return(XDMF_SUCCESS);
69 }
70 
71 }
72