Orfeo Toolbox  3.16
itkFEMLoadBC.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkFEMLoadBC.cxx,v $
5  Language: C++
6  Date: $Date: 2009-01-30 21:10:12 $
7  Version: $Revision: 1.9 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 // disable debug warnings in MS compiler
19 #ifdef _MSC_VER
20 #pragma warning(disable: 4786)
21 #endif
22 
23 #include "itkFEMLoadBC.h"
24 
25 namespace itk {
26 namespace fem {
27 
29 void LoadBC::Read( std::istream& f, void* info )
30 {
31  unsigned int n;
35  ReadInfoType::ElementArrayPointer elements=static_cast<ReadInfoType*>(info)->m_el;
36 
37 
38  /* first call the parent's Read function */
39  Superclass::Read(f,info);
40 
41  /* read and set pointer to element that we're applying the load to */
42  this->SkipWhiteSpace(f); f>>n; if(!f) goto out;
43  try
44  {
45  this->m_element=dynamic_cast<const Element*>( &*elements->Find(n) );
46  }
47  catch ( FEMExceptionObjectNotFound e )
48  {
49  throw FEMExceptionObjectNotFound(__FILE__,__LINE__,"LoadBC::Read()",e.m_baseClassName,e.m_GN);
50  }
51 
52  /* read the local DOF number within that element */
53  this->SkipWhiteSpace(f); f>>this->m_dof; if(!f) goto out;
54 
55  /* read the value to which the DOF is fixed */
56  this->SkipWhiteSpace(f); f>>n; if(!f) goto out;
57  this->m_value.set_size(n);
58  this->SkipWhiteSpace(f); f>>this->m_value; if(!f) goto out;
59 
60  out:
61 
62  if( !f )
63  {
64  throw FEMExceptionIO(__FILE__,__LINE__,"LoadBC::Read()","Error reading FEM load!");
65  }
66 
67 }
68 
69 
73 void LoadBC::Write( std::ostream& f ) const
74 {
75  /* first call the parent's write function */
77 
78  /*
79  * Write the actual Load data
80  */
81  f<<"\t"<<this->m_element->GN<<"\t% GN of element"<<"\n";
82  f<<"\t"<<this->m_dof<<"\t% DOF# in element"<<"\n";
83 
84  /* write the value of dof */
85  f<<"\t"<<this->m_value.size();
86  f<<" "<<this->m_value<<"\t% value of the fixed DOF"<<"\n";
87 
88  /* check for errors */
89  if (!f)
90  {
91  throw FEMExceptionIO(__FILE__,__LINE__,"LoadBC::Write()","Error writing FEM load!");
92  }
93 
94 }
95 
97 
98 }} // end namespace itk::fem

Generated at Sat Feb 2 2013 23:36:47 for Orfeo Toolbox with doxygen 1.8.1.1