1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3 4# 5# Generated Sun Mar 23 02:03:52 2014 by generateDS.py version 2.12b. 6# 7 8import sys 9import getopt 10import re as re_ 11import base64 12import datetime as datetime_ 13 14etree_ = None 15Verbose_import_ = False 16( 17 XMLParser_import_none, XMLParser_import_lxml, 18 XMLParser_import_elementtree 19) = list(range(3)) 20XMLParser_import_library = None 21try: 22 # lxml 23 from lxml import etree as etree_ 24 XMLParser_import_library = XMLParser_import_lxml 25 if Verbose_import_: 26 print("running with lxml.etree") 27except ImportError: 28 try: 29 # cElementTree from Python 2.5+ 30 import xml.etree.cElementTree as etree_ 31 XMLParser_import_library = XMLParser_import_elementtree 32 if Verbose_import_: 33 print("running with cElementTree on Python 2.5+") 34 except ImportError: 35 try: 36 # ElementTree from Python 2.5+ 37 import xml.etree.ElementTree as etree_ 38 XMLParser_import_library = XMLParser_import_elementtree 39 if Verbose_import_: 40 print("running with ElementTree on Python 2.5+") 41 except ImportError: 42 try: 43 # normal cElementTree install 44 import cElementTree as etree_ 45 XMLParser_import_library = XMLParser_import_elementtree 46 if Verbose_import_: 47 print("running with cElementTree") 48 except ImportError: 49 try: 50 # normal ElementTree install 51 import elementtree.ElementTree as etree_ 52 XMLParser_import_library = XMLParser_import_elementtree 53 if Verbose_import_: 54 print("running with ElementTree") 55 except ImportError: 56 raise ImportError( 57 "Failed to import ElementTree from any known place") 58 59 60def parsexml_(*args, **kwargs): 61 if (XMLParser_import_library == XMLParser_import_lxml and 62 'parser' not in kwargs): 63 # Use the lxml ElementTree compatible parser so that, e.g., 64 # we ignore comments. 65 kwargs['parser'] = etree_.ETCompatXMLParser() 66 doc = etree_.parse(*args, **kwargs) 67 return doc 68 69# 70# User methods 71# 72# Calls to the methods in these classes are generated by generateDS.py. 73# You can replace these methods by re-implementing the following class 74# in a module named generatedssuper.py. 75 76try: 77 from generatedssuper import GeneratedsSuper 78except ImportError as exp: 79 80 class GeneratedsSuper(object): 81 tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') 82 class _FixedOffsetTZ(datetime_.tzinfo): 83 def __init__(self, offset, name): 84 self.__offset = datetime_.timedelta(minutes=offset) 85 self.__name = name 86 def utcoffset(self, dt): 87 return self.__offset 88 def tzname(self, dt): 89 return self.__name 90 def dst(self, dt): 91 return None 92 def gds_format_string(self, input_data, input_name=''): 93 return input_data 94 def gds_validate_string(self, input_data, node, input_name=''): 95 if not input_data: 96 return '' 97 else: 98 return input_data 99 def gds_format_base64(self, input_data, input_name=''): 100 return base64.b64encode(input_data) 101 def gds_validate_base64(self, input_data, node, input_name=''): 102 return input_data 103 def gds_format_integer(self, input_data, input_name=''): 104 return '%d' % input_data 105 def gds_validate_integer(self, input_data, node, input_name=''): 106 return input_data 107 def gds_format_integer_list(self, input_data, input_name=''): 108 return '%s' % input_data 109 def gds_validate_integer_list(self, input_data, node, input_name=''): 110 values = input_data.split() 111 for value in values: 112 try: 113 float(value) 114 except (TypeError, ValueError): 115 raise_parse_error(node, 'Requires sequence of integers') 116 return input_data 117 def gds_format_float(self, input_data, input_name=''): 118 return ('%.15f' % input_data).rstrip('0') 119 def gds_validate_float(self, input_data, node, input_name=''): 120 return input_data 121 def gds_format_float_list(self, input_data, input_name=''): 122 return '%s' % input_data 123 def gds_validate_float_list(self, input_data, node, input_name=''): 124 values = input_data.split() 125 for value in values: 126 try: 127 float(value) 128 except (TypeError, ValueError): 129 raise_parse_error(node, 'Requires sequence of floats') 130 return input_data 131 def gds_format_double(self, input_data, input_name=''): 132 return '%e' % input_data 133 def gds_validate_double(self, input_data, node, input_name=''): 134 return input_data 135 def gds_format_double_list(self, input_data, input_name=''): 136 return '%s' % input_data 137 def gds_validate_double_list(self, input_data, node, input_name=''): 138 values = input_data.split() 139 for value in values: 140 try: 141 float(value) 142 except (TypeError, ValueError): 143 raise_parse_error(node, 'Requires sequence of doubles') 144 return input_data 145 def gds_format_boolean(self, input_data, input_name=''): 146 return ('%s' % input_data).lower() 147 def gds_validate_boolean(self, input_data, node, input_name=''): 148 return input_data 149 def gds_format_boolean_list(self, input_data, input_name=''): 150 return '%s' % input_data 151 def gds_validate_boolean_list(self, input_data, node, input_name=''): 152 values = input_data.split() 153 for value in values: 154 if value not in ('true', '1', 'false', '0', ): 155 raise_parse_error( 156 node, 157 'Requires sequence of booleans ' 158 '("true", "1", "false", "0")') 159 return input_data 160 def gds_validate_datetime(self, input_data, node, input_name=''): 161 return input_data 162 def gds_format_datetime(self, input_data, input_name=''): 163 if input_data.microsecond == 0: 164 _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( 165 input_data.year, 166 input_data.month, 167 input_data.day, 168 input_data.hour, 169 input_data.minute, 170 input_data.second, 171 ) 172 else: 173 _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( 174 input_data.year, 175 input_data.month, 176 input_data.day, 177 input_data.hour, 178 input_data.minute, 179 input_data.second, 180 ('%f' % (float(input_data.microsecond) / 1000000))[2:], 181 ) 182 if input_data.tzinfo is not None: 183 tzoff = input_data.tzinfo.utcoffset(input_data) 184 if tzoff is not None: 185 total_seconds = tzoff.seconds + (86400 * tzoff.days) 186 if total_seconds == 0: 187 _svalue += 'Z' 188 else: 189 if total_seconds < 0: 190 _svalue += '-' 191 total_seconds *= -1 192 else: 193 _svalue += '+' 194 hours = total_seconds // 3600 195 minutes = (total_seconds - (hours * 3600)) // 60 196 _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) 197 return _svalue 198 @classmethod 199 def gds_parse_datetime(cls, input_data): 200 tz = None 201 if input_data[-1] == 'Z': 202 tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') 203 input_data = input_data[:-1] 204 else: 205 results = GeneratedsSuper.tzoff_pattern.search(input_data) 206 if results is not None: 207 tzoff_parts = results.group(2).split(':') 208 tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) 209 if results.group(1) == '-': 210 tzoff *= -1 211 tz = GeneratedsSuper._FixedOffsetTZ( 212 tzoff, results.group(0)) 213 input_data = input_data[:-6] 214 if len(input_data.split('.')) > 1: 215 dt = datetime_.datetime.strptime( 216 input_data, '%Y-%m-%dT%H:%M:%S.%f') 217 else: 218 dt = datetime_.datetime.strptime( 219 input_data, '%Y-%m-%dT%H:%M:%S') 220 dt = dt.replace(tzinfo=tz) 221 return dt 222 def gds_validate_date(self, input_data, node, input_name=''): 223 return input_data 224 def gds_format_date(self, input_data, input_name=''): 225 _svalue = '%04d-%02d-%02d' % ( 226 input_data.year, 227 input_data.month, 228 input_data.day, 229 ) 230 try: 231 if input_data.tzinfo is not None: 232 tzoff = input_data.tzinfo.utcoffset(input_data) 233 if tzoff is not None: 234 total_seconds = tzoff.seconds + (86400 * tzoff.days) 235 if total_seconds == 0: 236 _svalue += 'Z' 237 else: 238 if total_seconds < 0: 239 _svalue += '-' 240 total_seconds *= -1 241 else: 242 _svalue += '+' 243 hours = total_seconds // 3600 244 minutes = (total_seconds - (hours * 3600)) // 60 245 _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) 246 except AttributeError: 247 pass 248 return _svalue 249 @classmethod 250 def gds_parse_date(cls, input_data): 251 tz = None 252 if input_data[-1] == 'Z': 253 tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') 254 input_data = input_data[:-1] 255 else: 256 results = GeneratedsSuper.tzoff_pattern.search(input_data) 257 if results is not None: 258 tzoff_parts = results.group(2).split(':') 259 tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) 260 if results.group(1) == '-': 261 tzoff *= -1 262 tz = GeneratedsSuper._FixedOffsetTZ( 263 tzoff, results.group(0)) 264 input_data = input_data[:-6] 265 dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') 266 dt = dt.replace(tzinfo=tz) 267 return dt.date() 268 def gds_validate_time(self, input_data, node, input_name=''): 269 return input_data 270 def gds_format_time(self, input_data, input_name=''): 271 if input_data.microsecond == 0: 272 _svalue = '%02d:%02d:%02d' % ( 273 input_data.hour, 274 input_data.minute, 275 input_data.second, 276 ) 277 else: 278 _svalue = '%02d:%02d:%02d.%s' % ( 279 input_data.hour, 280 input_data.minute, 281 input_data.second, 282 ('%f' % (float(input_data.microsecond) / 1000000))[2:], 283 ) 284 if input_data.tzinfo is not None: 285 tzoff = input_data.tzinfo.utcoffset(input_data) 286 if tzoff is not None: 287 total_seconds = tzoff.seconds + (86400 * tzoff.days) 288 if total_seconds == 0: 289 _svalue += 'Z' 290 else: 291 if total_seconds < 0: 292 _svalue += '-' 293 total_seconds *= -1 294 else: 295 _svalue += '+' 296 hours = total_seconds // 3600 297 minutes = (total_seconds - (hours * 3600)) // 60 298 _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) 299 return _svalue 300 @classmethod 301 def gds_parse_time(cls, input_data): 302 tz = None 303 if input_data[-1] == 'Z': 304 tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') 305 input_data = input_data[:-1] 306 else: 307 results = GeneratedsSuper.tzoff_pattern.search(input_data) 308 if results is not None: 309 tzoff_parts = results.group(2).split(':') 310 tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) 311 if results.group(1) == '-': 312 tzoff *= -1 313 tz = GeneratedsSuper._FixedOffsetTZ( 314 tzoff, results.group(0)) 315 input_data = input_data[:-6] 316 if len(input_data.split('.')) > 1: 317 dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') 318 else: 319 dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') 320 dt = dt.replace(tzinfo=tz) 321 return dt.time() 322 def gds_str_lower(self, instring): 323 return instring.lower() 324 def get_path_(self, node): 325 path_list = [] 326 self.get_path_list_(node, path_list) 327 path_list.reverse() 328 path = '/'.join(path_list) 329 return path 330 Tag_strip_pattern_ = re_.compile(r'\{.*\}') 331 def get_path_list_(self, node, path_list): 332 if node is None: 333 return 334 tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) 335 if tag: 336 path_list.append(tag) 337 self.get_path_list_(node.getparent(), path_list) 338 def get_class_obj_(self, node, default_class=None): 339 class_obj1 = default_class 340 if 'xsi' in node.nsmap: 341 classname = node.get('{%s}type' % node.nsmap['xsi']) 342 if classname is not None: 343 names = classname.split(':') 344 if len(names) == 2: 345 classname = names[1] 346 class_obj2 = globals().get(classname) 347 if class_obj2 is not None: 348 class_obj1 = class_obj2 349 return class_obj1 350 def gds_build_any(self, node, type_name=None): 351 return None 352 @classmethod 353 def gds_reverse_node_mapping(cls, mapping): 354 return dict(((v, k) for k, v in mapping.items())) 355 356 357# 358# If you have installed IPython you can uncomment and use the following. 359# IPython is available from http://ipython.scipy.org/. 360# 361 362## from IPython.Shell import IPShellEmbed 363## args = '' 364## ipshell = IPShellEmbed(args, 365## banner = 'Dropping into IPython', 366## exit_msg = 'Leaving Interpreter, back to program.') 367 368# Then use the following line where and when you want to drop into the 369# IPython shell: 370# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') 371 372# 373# Globals 374# 375 376ExternalEncoding = 'ascii' 377Tag_pattern_ = re_.compile(r'({.*})?(.*)') 378String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") 379Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') 380 381# 382# Support/utility functions. 383# 384 385 386def showIndent(outfile, level, pretty_print=True): 387 if pretty_print: 388 for idx in range(level): 389 outfile.write(' ') 390 391 392def quote_xml(inStr): 393 if not inStr: 394 return '' 395 s1 = (isinstance(inStr, str) and inStr or 396 '%s' % inStr) 397 s1 = s1.replace('&', '&') 398 s1 = s1.replace('<', '<') 399 s1 = s1.replace('>', '>') 400 return s1 401 402 403def quote_attrib(inStr): 404 s1 = (isinstance(inStr, str) and inStr or 405 '%s' % inStr) 406 s1 = s1.replace('&', '&') 407 s1 = s1.replace('<', '<') 408 s1 = s1.replace('>', '>') 409 if '"' in s1: 410 if "'" in s1: 411 s1 = '"%s"' % s1.replace('"', """) 412 else: 413 s1 = "'%s'" % s1 414 else: 415 s1 = '"%s"' % s1 416 return s1 417 418 419def quote_python(inStr): 420 s1 = inStr 421 if s1.find("'") == -1: 422 if s1.find('\n') == -1: 423 return "'%s'" % s1 424 else: 425 return "'''%s'''" % s1 426 else: 427 if s1.find('"') != -1: 428 s1 = s1.replace('"', '\\"') 429 if s1.find('\n') == -1: 430 return '"%s"' % s1 431 else: 432 return '"""%s"""' % s1 433 434 435def get_all_text_(node): 436 if node.text is not None: 437 text = node.text 438 else: 439 text = '' 440 for child in node: 441 if child.tail is not None: 442 text += child.tail 443 return text 444 445 446def find_attr_value_(attr_name, node): 447 attrs = node.attrib 448 attr_parts = attr_name.split(':') 449 value = None 450 if len(attr_parts) == 1: 451 value = attrs.get(attr_name) 452 elif len(attr_parts) == 2: 453 prefix, name = attr_parts 454 namespace = node.nsmap.get(prefix) 455 if namespace is not None: 456 value = attrs.get('{%s}%s' % (namespace, name, )) 457 return value 458 459 460class GDSParseError(Exception): 461 pass 462 463 464def raise_parse_error(node, msg): 465 if XMLParser_import_library == XMLParser_import_lxml: 466 msg = '%s (element %s/line %d)' % ( 467 msg, node.tag, node.sourceline, ) 468 else: 469 msg = '%s (element %s)' % (msg, node.tag, ) 470 raise GDSParseError(msg) 471 472 473class MixedContainer: 474 # Constants for category: 475 CategoryNone = 0 476 CategoryText = 1 477 CategorySimple = 2 478 CategoryComplex = 3 479 # Constants for content_type: 480 TypeNone = 0 481 TypeText = 1 482 TypeString = 2 483 TypeInteger = 3 484 TypeFloat = 4 485 TypeDecimal = 5 486 TypeDouble = 6 487 TypeBoolean = 7 488 TypeBase64 = 8 489 def __init__(self, category, content_type, name, value): 490 self.category = category 491 self.content_type = content_type 492 self.name = name 493 self.value = value 494 def getCategory(self): 495 return self.category 496 def getContenttype(self, content_type): 497 return self.content_type 498 def getValue(self): 499 return self.value 500 def getName(self): 501 return self.name 502 def export(self, outfile, level, name, namespace, pretty_print=True): 503 if self.category == MixedContainer.CategoryText: 504 # Prevent exporting empty content as empty lines. 505 if self.value.strip(): 506 outfile.write(self.value) 507 elif self.category == MixedContainer.CategorySimple: 508 self.exportSimple(outfile, level, name) 509 else: # category == MixedContainer.CategoryComplex 510 self.value.export(outfile, level, namespace, name, pretty_print) 511 def exportSimple(self, outfile, level, name): 512 if self.content_type == MixedContainer.TypeString: 513 outfile.write('<%s>%s</%s>' % ( 514 self.name, self.value, self.name)) 515 elif self.content_type == MixedContainer.TypeInteger or \ 516 self.content_type == MixedContainer.TypeBoolean: 517 outfile.write('<%s>%d</%s>' % ( 518 self.name, self.value, self.name)) 519 elif self.content_type == MixedContainer.TypeFloat or \ 520 self.content_type == MixedContainer.TypeDecimal: 521 outfile.write('<%s>%f</%s>' % ( 522 self.name, self.value, self.name)) 523 elif self.content_type == MixedContainer.TypeDouble: 524 outfile.write('<%s>%g</%s>' % ( 525 self.name, self.value, self.name)) 526 elif self.content_type == MixedContainer.TypeBase64: 527 outfile.write('<%s>%s</%s>' % ( 528 self.name, base64.b64encode(self.value), self.name)) 529 def to_etree(self, element): 530 if self.category == MixedContainer.CategoryText: 531 # Prevent exporting empty content as empty lines. 532 if self.value.strip(): 533 if len(element) > 0: 534 if element[-1].tail is None: 535 element[-1].tail = self.value 536 else: 537 element[-1].tail += self.value 538 else: 539 if element.text is None: 540 element.text = self.value 541 else: 542 element.text += self.value 543 elif self.category == MixedContainer.CategorySimple: 544 subelement = etree_.SubElement(element, '%s' % self.name) 545 subelement.text = self.to_etree_simple() 546 else: # category == MixedContainer.CategoryComplex 547 self.value.to_etree(element) 548 def to_etree_simple(self): 549 if self.content_type == MixedContainer.TypeString: 550 text = self.value 551 elif (self.content_type == MixedContainer.TypeInteger or 552 self.content_type == MixedContainer.TypeBoolean): 553 text = '%d' % self.value 554 elif (self.content_type == MixedContainer.TypeFloat or 555 self.content_type == MixedContainer.TypeDecimal): 556 text = '%f' % self.value 557 elif self.content_type == MixedContainer.TypeDouble: 558 text = '%g' % self.value 559 elif self.content_type == MixedContainer.TypeBase64: 560 text = '%s' % base64.b64encode(self.value) 561 return text 562 def exportLiteral(self, outfile, level, name): 563 if self.category == MixedContainer.CategoryText: 564 showIndent(outfile, level) 565 outfile.write( 566 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( 567 self.category, self.content_type, self.name, self.value)) 568 elif self.category == MixedContainer.CategorySimple: 569 showIndent(outfile, level) 570 outfile.write( 571 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( 572 self.category, self.content_type, self.name, self.value)) 573 else: # category == MixedContainer.CategoryComplex 574 showIndent(outfile, level) 575 outfile.write( 576 'model_.MixedContainer(%d, %d, "%s",\n' % ( 577 self.category, self.content_type, self.name,)) 578 self.value.exportLiteral(outfile, level + 1) 579 showIndent(outfile, level) 580 outfile.write(')\n') 581 582 583class MemberSpec_(object): 584 def __init__(self, name='', data_type='', container=0): 585 self.name = name 586 self.data_type = data_type 587 self.container = container 588 def set_name(self, name): self.name = name 589 def get_name(self): return self.name 590 def set_data_type(self, data_type): self.data_type = data_type 591 def get_data_type_chain(self): return self.data_type 592 def get_data_type(self): 593 if isinstance(self.data_type, list): 594 if len(self.data_type) > 0: 595 return self.data_type[-1] 596 else: 597 return 'xs:string' 598 else: 599 return self.data_type 600 def set_container(self, container): self.container = container 601 def get_container(self): return self.container 602 603 604def _cast(typ, value): 605 if typ is None or value is None: 606 return value 607 return typ(value) 608 609# 610# Data representation classes. 611# 612 613 614class pluginDef(GeneratedsSuper): 615 subclass = None 616 superclass = None 617 def __init__(self, plugin=None, valueOf_=None): 618 self.plugin = _cast(None, plugin) 619 self.valueOf_ = valueOf_ 620 def factory(*args_, **kwargs_): 621 if pluginDef.subclass: 622 return pluginDef.subclass(*args_, **kwargs_) 623 else: 624 return pluginDef(*args_, **kwargs_) 625 factory = staticmethod(factory) 626 def get_plugin(self): return self.plugin 627 def set_plugin(self, plugin): self.plugin = plugin 628 def get_valueOf_(self): return self.valueOf_ 629 def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ 630 def validate_pluginType(self, value): 631 # Validate type pluginType, a restriction on xsd:string. 632 pass 633 def hasContent_(self): 634 if ( 635 self.valueOf_ 636 ): 637 return True 638 else: 639 return False 640 def export(self, outfile, level, namespace_='', name_='pluginDef', namespacedef_='', pretty_print=True): 641 if pretty_print: 642 eol_ = '\n' 643 else: 644 eol_ = '' 645 showIndent(outfile, level, pretty_print) 646 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 647 already_processed = set() 648 self.exportAttributes(outfile, level, already_processed, namespace_, name_='pluginDef') 649 if self.hasContent_(): 650 outfile.write('>') 651 outfile.write(str(self.valueOf_).encode(ExternalEncoding)) 652 self.exportChildren(outfile, level + 1, namespace_='', name_='pluginDef', pretty_print=pretty_print) 653 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 654 else: 655 outfile.write('/>%s' % (eol_, )) 656 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='pluginDef'): 657 if self.plugin is not None and 'plugin' not in already_processed: 658 already_processed.add('plugin') 659 outfile.write(' plugin=%s' % (quote_attrib(self.plugin), )) 660 def exportChildren(self, outfile, level, namespace_='', name_='pluginDef', fromsubclass_=False, pretty_print=True): 661 pass 662 def exportLiteral(self, outfile, level, name_='pluginDef'): 663 level += 1 664 already_processed = set() 665 self.exportLiteralAttributes(outfile, level, already_processed, name_) 666 if self.hasContent_(): 667 self.exportLiteralChildren(outfile, level, name_) 668 showIndent(outfile, level) 669 outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) 670 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 671 if self.plugin is not None and 'plugin' not in already_processed: 672 already_processed.add('plugin') 673 showIndent(outfile, level) 674 outfile.write('plugin="%s",\n' % (self.plugin,)) 675 def exportLiteralChildren(self, outfile, level, name_): 676 pass 677 def build(self, node): 678 already_processed = set() 679 self.buildAttributes(node, node.attrib, already_processed) 680 self.valueOf_ = get_all_text_(node) 681 for child in node: 682 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 683 self.buildChildren(child, node, nodeName_) 684 return self 685 def buildAttributes(self, node, attrs, already_processed): 686 value = find_attr_value_('plugin', node) 687 if value is not None and 'plugin' not in already_processed: 688 already_processed.add('plugin') 689 self.plugin = value 690 self.validate_pluginType(self.plugin) # validate type pluginType 691 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 692 pass 693# end class pluginDef 694 695 696class emptyType(GeneratedsSuper): 697 subclass = None 698 superclass = None 699 def __init__(self, all=None): 700 self.all = _cast(float, all) 701 pass 702 def factory(*args_, **kwargs_): 703 if emptyType.subclass: 704 return emptyType.subclass(*args_, **kwargs_) 705 else: 706 return emptyType(*args_, **kwargs_) 707 factory = staticmethod(factory) 708 def get_all(self): return self.all 709 def set_all(self, all): self.all = all 710 def hasContent_(self): 711 if ( 712 713 ): 714 return True 715 else: 716 return False 717 def export(self, outfile, level, namespace_='', name_='emptyType', namespacedef_='', pretty_print=True): 718 if pretty_print: 719 eol_ = '\n' 720 else: 721 eol_ = '' 722 showIndent(outfile, level, pretty_print) 723 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 724 already_processed = set() 725 self.exportAttributes(outfile, level, already_processed, namespace_, name_='emptyType') 726 if self.hasContent_(): 727 outfile.write('>%s' % (eol_, )) 728 self.exportChildren(outfile, level + 1, namespace_='', name_='emptyType', pretty_print=pretty_print) 729 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 730 else: 731 outfile.write('/>%s' % (eol_, )) 732 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='emptyType'): 733 if self.all is not None and 'all' not in already_processed: 734 already_processed.add('all') 735 outfile.write(' all="%s"' % self.gds_format_double(self.all, input_name='all')) 736 def exportChildren(self, outfile, level, namespace_='', name_='emptyType', fromsubclass_=False, pretty_print=True): 737 pass 738 def exportLiteral(self, outfile, level, name_='emptyType'): 739 level += 1 740 already_processed = set() 741 self.exportLiteralAttributes(outfile, level, already_processed, name_) 742 if self.hasContent_(): 743 self.exportLiteralChildren(outfile, level, name_) 744 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 745 if self.all is not None and 'all' not in already_processed: 746 already_processed.add('all') 747 showIndent(outfile, level) 748 outfile.write('all=%e,\n' % (self.all,)) 749 def exportLiteralChildren(self, outfile, level, name_): 750 pass 751 def build(self, node): 752 already_processed = set() 753 self.buildAttributes(node, node.attrib, already_processed) 754 for child in node: 755 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 756 self.buildChildren(child, node, nodeName_) 757 return self 758 def buildAttributes(self, node, attrs, already_processed): 759 value = find_attr_value_('all', node) 760 if value is not None and 'all' not in already_processed: 761 already_processed.add('all') 762 try: 763 self.all = float(value) 764 except ValueError as exp: 765 raise ValueError('Bad float/double attribute (all): %s' % exp) 766 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 767 pass 768# end class emptyType 769 770 771class vector(GeneratedsSuper): 772 subclass = None 773 superclass = None 774 def __init__(self, vectorSize=1, vectorFile=None, all=False, vectorPlugin=None, valueOf_=None): 775 self.vectorSize = _cast(int, vectorSize) 776 self.vectorFile = _cast(None, vectorFile) 777 self.all = _cast(bool, all) 778 self.vectorPlugin = _cast(None, vectorPlugin) 779 self.valueOf_ = valueOf_ 780 def factory(*args_, **kwargs_): 781 if vector.subclass: 782 return vector.subclass(*args_, **kwargs_) 783 else: 784 return vector(*args_, **kwargs_) 785 factory = staticmethod(factory) 786 def get_vectorSize(self): return self.vectorSize 787 def set_vectorSize(self, vectorSize): self.vectorSize = vectorSize 788 def get_vectorFile(self): return self.vectorFile 789 def set_vectorFile(self, vectorFile): self.vectorFile = vectorFile 790 def get_all(self): return self.all 791 def set_all(self, all): self.all = all 792 def get_vectorPlugin(self): return self.vectorPlugin 793 def set_vectorPlugin(self, vectorPlugin): self.vectorPlugin = vectorPlugin 794 def get_valueOf_(self): return self.valueOf_ 795 def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ 796 def validate_pluginType(self, value): 797 # Validate type pluginType, a restriction on xsd:string. 798 pass 799 def hasContent_(self): 800 if ( 801 self.valueOf_ 802 ): 803 return True 804 else: 805 return False 806 def export(self, outfile, level, namespace_='', name_='vector', namespacedef_='', pretty_print=True): 807 if pretty_print: 808 eol_ = '\n' 809 else: 810 eol_ = '' 811 showIndent(outfile, level, pretty_print) 812 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 813 already_processed = set() 814 self.exportAttributes(outfile, level, already_processed, namespace_, name_='vector') 815 if self.hasContent_(): 816 outfile.write('>') 817 outfile.write(str(self.valueOf_).encode(ExternalEncoding)) 818 self.exportChildren(outfile, level + 1, namespace_='', name_='vector', pretty_print=pretty_print) 819 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 820 else: 821 outfile.write('/>%s' % (eol_, )) 822 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='vector'): 823 if self.vectorSize is not None and 'vectorSize' not in already_processed: 824 already_processed.add('vectorSize') 825 outfile.write(' vectorSize="%s"' % self.gds_format_integer(self.vectorSize, input_name='vectorSize')) 826 if self.vectorFile is not None and 'vectorFile' not in already_processed: 827 already_processed.add('vectorFile') 828 outfile.write(' vectorFile=%s' % (self.gds_format_string(quote_attrib(self.vectorFile).encode(ExternalEncoding), input_name='vectorFile'), )) 829 if self.all is not None and 'all' not in already_processed: 830 already_processed.add('all') 831 outfile.write(' all="%s"' % self.gds_format_boolean(self.all, input_name='all')) 832 if self.vectorPlugin is not None and 'vectorPlugin' not in already_processed: 833 already_processed.add('vectorPlugin') 834 outfile.write(' vectorPlugin=%s' % (quote_attrib(self.vectorPlugin), )) 835 def exportChildren(self, outfile, level, namespace_='', name_='vector', fromsubclass_=False, pretty_print=True): 836 pass 837 def exportLiteral(self, outfile, level, name_='vector'): 838 level += 1 839 already_processed = set() 840 self.exportLiteralAttributes(outfile, level, already_processed, name_) 841 if self.hasContent_(): 842 self.exportLiteralChildren(outfile, level, name_) 843 showIndent(outfile, level) 844 outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) 845 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 846 if self.vectorSize is not None and 'vectorSize' not in already_processed: 847 already_processed.add('vectorSize') 848 showIndent(outfile, level) 849 outfile.write('vectorSize=%d,\n' % (self.vectorSize,)) 850 if self.vectorFile is not None and 'vectorFile' not in already_processed: 851 already_processed.add('vectorFile') 852 showIndent(outfile, level) 853 outfile.write('vectorFile="%s",\n' % (self.vectorFile,)) 854 if self.all is not None and 'all' not in already_processed: 855 already_processed.add('all') 856 showIndent(outfile, level) 857 outfile.write('all=%s,\n' % (self.all,)) 858 if self.vectorPlugin is not None and 'vectorPlugin' not in already_processed: 859 already_processed.add('vectorPlugin') 860 showIndent(outfile, level) 861 outfile.write('vectorPlugin="%s",\n' % (self.vectorPlugin,)) 862 def exportLiteralChildren(self, outfile, level, name_): 863 pass 864 def build(self, node): 865 already_processed = set() 866 self.buildAttributes(node, node.attrib, already_processed) 867 self.valueOf_ = get_all_text_(node) 868 for child in node: 869 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 870 self.buildChildren(child, node, nodeName_) 871 return self 872 def buildAttributes(self, node, attrs, already_processed): 873 value = find_attr_value_('vectorSize', node) 874 if value is not None and 'vectorSize' not in already_processed: 875 already_processed.add('vectorSize') 876 try: 877 self.vectorSize = int(value) 878 except ValueError as exp: 879 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 880 if self.vectorSize < 0: 881 raise_parse_error(node, 'Invalid NonNegativeInteger') 882 value = find_attr_value_('vectorFile', node) 883 if value is not None and 'vectorFile' not in already_processed: 884 already_processed.add('vectorFile') 885 self.vectorFile = value 886 value = find_attr_value_('all', node) 887 if value is not None and 'all' not in already_processed: 888 already_processed.add('all') 889 if value in ('true', '1'): 890 self.all = True 891 elif value in ('false', '0'): 892 self.all = False 893 else: 894 raise_parse_error(node, 'Bad boolean attribute') 895 value = find_attr_value_('vectorPlugin', node) 896 if value is not None and 'vectorPlugin' not in already_processed: 897 already_processed.add('vectorPlugin') 898 self.vectorPlugin = value 899 self.validate_pluginType(self.vectorPlugin) # validate type pluginType 900 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 901 pass 902# end class vector 903 904 905class matrix(GeneratedsSuper): 906 subclass = None 907 superclass = None 908 def __init__(self, matrixColSize=None, matrixFile=None, matrixPlugin=None, matrixRowSize=None, row=None): 909 self.matrixColSize = _cast(int, matrixColSize) 910 self.matrixFile = _cast(None, matrixFile) 911 self.matrixPlugin = _cast(None, matrixPlugin) 912 self.matrixRowSize = _cast(int, matrixRowSize) 913 if row is None: 914 self.row = [] 915 else: 916 self.row = row 917 def factory(*args_, **kwargs_): 918 if matrix.subclass: 919 return matrix.subclass(*args_, **kwargs_) 920 else: 921 return matrix(*args_, **kwargs_) 922 factory = staticmethod(factory) 923 def get_row(self): return self.row 924 def set_row(self, row): self.row = row 925 def add_row(self, value): self.row.append(value) 926 def insert_row(self, index, value): self.row[index] = value 927 def get_matrixColSize(self): return self.matrixColSize 928 def set_matrixColSize(self, matrixColSize): self.matrixColSize = matrixColSize 929 def get_matrixFile(self): return self.matrixFile 930 def set_matrixFile(self, matrixFile): self.matrixFile = matrixFile 931 def get_matrixPlugin(self): return self.matrixPlugin 932 def set_matrixPlugin(self, matrixPlugin): self.matrixPlugin = matrixPlugin 933 def get_matrixRowSize(self): return self.matrixRowSize 934 def set_matrixRowSize(self, matrixRowSize): self.matrixRowSize = matrixRowSize 935 def validate_doubleList(self, value): 936 # Validate type doubleList, a restriction on xsd:double. 937 pass 938 def validate_pluginType(self, value): 939 # Validate type pluginType, a restriction on xsd:string. 940 pass 941 def hasContent_(self): 942 if ( 943 self.row 944 ): 945 return True 946 else: 947 return False 948 def export(self, outfile, level, namespace_='', name_='matrix', namespacedef_='', pretty_print=True): 949 if pretty_print: 950 eol_ = '\n' 951 else: 952 eol_ = '' 953 showIndent(outfile, level, pretty_print) 954 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 955 already_processed = set() 956 self.exportAttributes(outfile, level, already_processed, namespace_, name_='matrix') 957 if self.hasContent_(): 958 outfile.write('>%s' % (eol_, )) 959 self.exportChildren(outfile, level + 1, namespace_='', name_='matrix', pretty_print=pretty_print) 960 showIndent(outfile, level, pretty_print) 961 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 962 else: 963 outfile.write('/>%s' % (eol_, )) 964 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='matrix'): 965 if self.matrixColSize is not None and 'matrixColSize' not in already_processed: 966 already_processed.add('matrixColSize') 967 outfile.write(' matrixColSize="%s"' % self.gds_format_integer(self.matrixColSize, input_name='matrixColSize')) 968 if self.matrixFile is not None and 'matrixFile' not in already_processed: 969 already_processed.add('matrixFile') 970 outfile.write(' matrixFile=%s' % (self.gds_format_string(quote_attrib(self.matrixFile).encode(ExternalEncoding), input_name='matrixFile'), )) 971 if self.matrixPlugin is not None and 'matrixPlugin' not in already_processed: 972 already_processed.add('matrixPlugin') 973 outfile.write(' matrixPlugin=%s' % (quote_attrib(self.matrixPlugin), )) 974 if self.matrixRowSize is not None and 'matrixRowSize' not in already_processed: 975 already_processed.add('matrixRowSize') 976 outfile.write(' matrixRowSize="%s"' % self.gds_format_integer(self.matrixRowSize, input_name='matrixRowSize')) 977 def exportChildren(self, outfile, level, namespace_='', name_='matrix', fromsubclass_=False, pretty_print=True): 978 if pretty_print: 979 eol_ = '\n' 980 else: 981 eol_ = '' 982 for row_ in self.row: 983 showIndent(outfile, level, pretty_print) 984 outfile.write('<%srow>%s</%srow>%s' % (namespace_, self.gds_format_double_list(row_, input_name='row'), namespace_, eol_)) 985 def exportLiteral(self, outfile, level, name_='matrix'): 986 level += 1 987 already_processed = set() 988 self.exportLiteralAttributes(outfile, level, already_processed, name_) 989 if self.hasContent_(): 990 self.exportLiteralChildren(outfile, level, name_) 991 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 992 if self.matrixColSize is not None and 'matrixColSize' not in already_processed: 993 already_processed.add('matrixColSize') 994 showIndent(outfile, level) 995 outfile.write('matrixColSize=%d,\n' % (self.matrixColSize,)) 996 if self.matrixFile is not None and 'matrixFile' not in already_processed: 997 already_processed.add('matrixFile') 998 showIndent(outfile, level) 999 outfile.write('matrixFile="%s",\n' % (self.matrixFile,)) 1000 if self.matrixPlugin is not None and 'matrixPlugin' not in already_processed: 1001 already_processed.add('matrixPlugin') 1002 showIndent(outfile, level) 1003 outfile.write('matrixPlugin="%s",\n' % (self.matrixPlugin,)) 1004 if self.matrixRowSize is not None and 'matrixRowSize' not in already_processed: 1005 already_processed.add('matrixRowSize') 1006 showIndent(outfile, level) 1007 outfile.write('matrixRowSize=%d,\n' % (self.matrixRowSize,)) 1008 def exportLiteralChildren(self, outfile, level, name_): 1009 showIndent(outfile, level) 1010 outfile.write('row=[\n') 1011 level += 1 1012 for row_ in self.row: 1013 showIndent(outfile, level) 1014 outfile.write('%e,\n' % row_) 1015 level -= 1 1016 showIndent(outfile, level) 1017 outfile.write('],\n') 1018 def build(self, node): 1019 already_processed = set() 1020 self.buildAttributes(node, node.attrib, already_processed) 1021 for child in node: 1022 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1023 self.buildChildren(child, node, nodeName_) 1024 return self 1025 def buildAttributes(self, node, attrs, already_processed): 1026 value = find_attr_value_('matrixColSize', node) 1027 if value is not None and 'matrixColSize' not in already_processed: 1028 already_processed.add('matrixColSize') 1029 try: 1030 self.matrixColSize = int(value) 1031 except ValueError as exp: 1032 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1033 if self.matrixColSize < 0: 1034 raise_parse_error(node, 'Invalid NonNegativeInteger') 1035 value = find_attr_value_('matrixFile', node) 1036 if value is not None and 'matrixFile' not in already_processed: 1037 already_processed.add('matrixFile') 1038 self.matrixFile = value 1039 value = find_attr_value_('matrixPlugin', node) 1040 if value is not None and 'matrixPlugin' not in already_processed: 1041 already_processed.add('matrixPlugin') 1042 self.matrixPlugin = value 1043 self.validate_pluginType(self.matrixPlugin) # validate type pluginType 1044 value = find_attr_value_('matrixRowSize', node) 1045 if value is not None and 'matrixRowSize' not in already_processed: 1046 already_processed.add('matrixRowSize') 1047 try: 1048 self.matrixRowSize = int(value) 1049 except ValueError as exp: 1050 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1051 if self.matrixRowSize < 0: 1052 raise_parse_error(node, 'Invalid NonNegativeInteger') 1053 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1054 if nodeName_ == 'row': 1055 row_ = child_.text 1056 row_ = self.gds_validate_double_list(row_, node, 'row') 1057 self.row.append(row_.split()) 1058 self.row = self.row 1059 self.validate_doubleList(self.row) # validate type doubleList 1060# end class matrix 1061 1062 1063class listOfMatrices(GeneratedsSuper): 1064 subclass = None 1065 superclass = None 1066 def __init__(self, number=None, matrix=None): 1067 self.number = _cast(int, number) 1068 if matrix is None: 1069 self.matrix = [] 1070 else: 1071 self.matrix = matrix 1072 def factory(*args_, **kwargs_): 1073 if listOfMatrices.subclass: 1074 return listOfMatrices.subclass(*args_, **kwargs_) 1075 else: 1076 return listOfMatrices(*args_, **kwargs_) 1077 factory = staticmethod(factory) 1078 def get_matrix(self): return self.matrix 1079 def set_matrix(self, matrix): self.matrix = matrix 1080 def add_matrix(self, value): self.matrix.append(value) 1081 def insert_matrix(self, index, value): self.matrix[index] = value 1082 def get_number(self): return self.number 1083 def set_number(self, number): self.number = number 1084 def hasContent_(self): 1085 if ( 1086 self.matrix 1087 ): 1088 return True 1089 else: 1090 return False 1091 def export(self, outfile, level, namespace_='', name_='listOfMatrices', namespacedef_='', pretty_print=True): 1092 if pretty_print: 1093 eol_ = '\n' 1094 else: 1095 eol_ = '' 1096 showIndent(outfile, level, pretty_print) 1097 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1098 already_processed = set() 1099 self.exportAttributes(outfile, level, already_processed, namespace_, name_='listOfMatrices') 1100 if self.hasContent_(): 1101 outfile.write('>%s' % (eol_, )) 1102 self.exportChildren(outfile, level + 1, namespace_='', name_='listOfMatrices', pretty_print=pretty_print) 1103 showIndent(outfile, level, pretty_print) 1104 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1105 else: 1106 outfile.write('/>%s' % (eol_, )) 1107 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='listOfMatrices'): 1108 if self.number is not None and 'number' not in already_processed: 1109 already_processed.add('number') 1110 outfile.write(' number="%s"' % self.gds_format_integer(self.number, input_name='number')) 1111 def exportChildren(self, outfile, level, namespace_='', name_='listOfMatrices', fromsubclass_=False, pretty_print=True): 1112 if pretty_print: 1113 eol_ = '\n' 1114 else: 1115 eol_ = '' 1116 for matrix_ in self.matrix: 1117 matrix_.export(outfile, level, namespace_, name_='matrix', pretty_print=pretty_print) 1118 def exportLiteral(self, outfile, level, name_='listOfMatrices'): 1119 level += 1 1120 already_processed = set() 1121 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1122 if self.hasContent_(): 1123 self.exportLiteralChildren(outfile, level, name_) 1124 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1125 if self.number is not None and 'number' not in already_processed: 1126 already_processed.add('number') 1127 showIndent(outfile, level) 1128 outfile.write('number=%d,\n' % (self.number,)) 1129 def exportLiteralChildren(self, outfile, level, name_): 1130 showIndent(outfile, level) 1131 outfile.write('matrix=[\n') 1132 level += 1 1133 for matrix_ in self.matrix: 1134 showIndent(outfile, level) 1135 outfile.write('model_.matrix(\n') 1136 matrix_.exportLiteral(outfile, level) 1137 showIndent(outfile, level) 1138 outfile.write('),\n') 1139 level -= 1 1140 showIndent(outfile, level) 1141 outfile.write('],\n') 1142 def build(self, node): 1143 already_processed = set() 1144 self.buildAttributes(node, node.attrib, already_processed) 1145 for child in node: 1146 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1147 self.buildChildren(child, node, nodeName_) 1148 return self 1149 def buildAttributes(self, node, attrs, already_processed): 1150 value = find_attr_value_('number', node) 1151 if value is not None and 'number' not in already_processed: 1152 already_processed.add('number') 1153 try: 1154 self.number = int(value) 1155 except ValueError as exp: 1156 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1157 if self.number < 0: 1158 raise_parse_error(node, 'Invalid NonNegativeInteger') 1159 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1160 if nodeName_ == 'matrix': 1161 obj_ = matrix.factory() 1162 obj_.build(child_) 1163 self.matrix.append(obj_) 1164# end class listOfMatrices 1165 1166 1167class matrixData(GeneratedsSuper): 1168 subclass = None 1169 superclass = None 1170 def __init__(self, matrixColSize=None, matrixRowSize=None, row=None): 1171 self.matrixColSize = _cast(int, matrixColSize) 1172 self.matrixRowSize = _cast(int, matrixRowSize) 1173 if row is None: 1174 self.row = [] 1175 else: 1176 self.row = row 1177 def factory(*args_, **kwargs_): 1178 if matrixData.subclass: 1179 return matrixData.subclass(*args_, **kwargs_) 1180 else: 1181 return matrixData(*args_, **kwargs_) 1182 factory = staticmethod(factory) 1183 def get_row(self): return self.row 1184 def set_row(self, row): self.row = row 1185 def add_row(self, value): self.row.append(value) 1186 def insert_row(self, index, value): self.row[index] = value 1187 def get_matrixColSize(self): return self.matrixColSize 1188 def set_matrixColSize(self, matrixColSize): self.matrixColSize = matrixColSize 1189 def get_matrixRowSize(self): return self.matrixRowSize 1190 def set_matrixRowSize(self, matrixRowSize): self.matrixRowSize = matrixRowSize 1191 def validate_doubleList(self, value): 1192 # Validate type doubleList, a restriction on xsd:double. 1193 pass 1194 def hasContent_(self): 1195 if ( 1196 self.row 1197 ): 1198 return True 1199 else: 1200 return False 1201 def export(self, outfile, level, namespace_='', name_='matrixData', namespacedef_='', pretty_print=True): 1202 if pretty_print: 1203 eol_ = '\n' 1204 else: 1205 eol_ = '' 1206 showIndent(outfile, level, pretty_print) 1207 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1208 already_processed = set() 1209 self.exportAttributes(outfile, level, already_processed, namespace_, name_='matrixData') 1210 if self.hasContent_(): 1211 outfile.write('>%s' % (eol_, )) 1212 self.exportChildren(outfile, level + 1, namespace_='', name_='matrixData', pretty_print=pretty_print) 1213 showIndent(outfile, level, pretty_print) 1214 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1215 else: 1216 outfile.write('/>%s' % (eol_, )) 1217 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='matrixData'): 1218 if self.matrixColSize is not None and 'matrixColSize' not in already_processed: 1219 already_processed.add('matrixColSize') 1220 outfile.write(' matrixColSize="%s"' % self.gds_format_integer(self.matrixColSize, input_name='matrixColSize')) 1221 if self.matrixRowSize is not None and 'matrixRowSize' not in already_processed: 1222 already_processed.add('matrixRowSize') 1223 outfile.write(' matrixRowSize="%s"' % self.gds_format_integer(self.matrixRowSize, input_name='matrixRowSize')) 1224 def exportChildren(self, outfile, level, namespace_='', name_='matrixData', fromsubclass_=False, pretty_print=True): 1225 if pretty_print: 1226 eol_ = '\n' 1227 else: 1228 eol_ = '' 1229 for row_ in self.row: 1230 showIndent(outfile, level, pretty_print) 1231 outfile.write('<%srow>%s</%srow>%s' % (namespace_, self.gds_format_double_list(row_, input_name='row'), namespace_, eol_)) 1232 def exportLiteral(self, outfile, level, name_='matrixData'): 1233 level += 1 1234 already_processed = set() 1235 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1236 if self.hasContent_(): 1237 self.exportLiteralChildren(outfile, level, name_) 1238 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1239 if self.matrixColSize is not None and 'matrixColSize' not in already_processed: 1240 already_processed.add('matrixColSize') 1241 showIndent(outfile, level) 1242 outfile.write('matrixColSize=%d,\n' % (self.matrixColSize,)) 1243 if self.matrixRowSize is not None and 'matrixRowSize' not in already_processed: 1244 already_processed.add('matrixRowSize') 1245 showIndent(outfile, level) 1246 outfile.write('matrixRowSize=%d,\n' % (self.matrixRowSize,)) 1247 def exportLiteralChildren(self, outfile, level, name_): 1248 showIndent(outfile, level) 1249 outfile.write('row=[\n') 1250 level += 1 1251 for row_ in self.row: 1252 showIndent(outfile, level) 1253 outfile.write('%e,\n' % row_) 1254 level -= 1 1255 showIndent(outfile, level) 1256 outfile.write('],\n') 1257 def build(self, node): 1258 already_processed = set() 1259 self.buildAttributes(node, node.attrib, already_processed) 1260 for child in node: 1261 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1262 self.buildChildren(child, node, nodeName_) 1263 return self 1264 def buildAttributes(self, node, attrs, already_processed): 1265 value = find_attr_value_('matrixColSize', node) 1266 if value is not None and 'matrixColSize' not in already_processed: 1267 already_processed.add('matrixColSize') 1268 try: 1269 self.matrixColSize = int(value) 1270 except ValueError as exp: 1271 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1272 if self.matrixColSize < 0: 1273 raise_parse_error(node, 'Invalid NonNegativeInteger') 1274 value = find_attr_value_('matrixRowSize', node) 1275 if value is not None and 'matrixRowSize' not in already_processed: 1276 already_processed.add('matrixRowSize') 1277 try: 1278 self.matrixRowSize = int(value) 1279 except ValueError as exp: 1280 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1281 if self.matrixRowSize < 0: 1282 raise_parse_error(node, 'Invalid NonNegativeInteger') 1283 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1284 if nodeName_ == 'row': 1285 row_ = child_.text 1286 row_ = self.gds_validate_double_list(row_, node, 'row') 1287 self.row.append(row_) 1288 self.row = self.row.split() 1289 self.validate_doubleList(self.row) # validate type doubleList 1290# end class matrixData 1291 1292 1293class matrixPlugin(GeneratedsSuper): 1294 subclass = None 1295 superclass = None 1296 def __init__(self, matrixPlugin=None): 1297 self.matrixPlugin = _cast(None, matrixPlugin) 1298 pass 1299 def factory(*args_, **kwargs_): 1300 if matrixPlugin.subclass: 1301 return matrixPlugin.subclass(*args_, **kwargs_) 1302 else: 1303 return matrixPlugin(*args_, **kwargs_) 1304 factory = staticmethod(factory) 1305 def get_matrixPlugin(self): return self.matrixPlugin 1306 def set_matrixPlugin(self, matrixPlugin): self.matrixPlugin = matrixPlugin 1307 def validate_pluginType(self, value): 1308 # Validate type pluginType, a restriction on xsd:string. 1309 pass 1310 def hasContent_(self): 1311 if ( 1312 1313 ): 1314 return True 1315 else: 1316 return False 1317 def export(self, outfile, level, namespace_='', name_='matrixPlugin', namespacedef_='', pretty_print=True): 1318 if pretty_print: 1319 eol_ = '\n' 1320 else: 1321 eol_ = '' 1322 showIndent(outfile, level, pretty_print) 1323 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1324 already_processed = set() 1325 self.exportAttributes(outfile, level, already_processed, namespace_, name_='matrixPlugin') 1326 if self.hasContent_(): 1327 outfile.write('>%s' % (eol_, )) 1328 self.exportChildren(outfile, level + 1, namespace_='', name_='matrixPlugin', pretty_print=pretty_print) 1329 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1330 else: 1331 outfile.write('/>%s' % (eol_, )) 1332 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='matrixPlugin'): 1333 if self.matrixPlugin is not None and 'matrixPlugin' not in already_processed: 1334 already_processed.add('matrixPlugin') 1335 outfile.write(' matrixPlugin=%s' % (quote_attrib(self.matrixPlugin), )) 1336 def exportChildren(self, outfile, level, namespace_='', name_='matrixPlugin', fromsubclass_=False, pretty_print=True): 1337 pass 1338 def exportLiteral(self, outfile, level, name_='matrixPlugin'): 1339 level += 1 1340 already_processed = set() 1341 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1342 if self.hasContent_(): 1343 self.exportLiteralChildren(outfile, level, name_) 1344 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1345 if self.matrixPlugin is not None and 'matrixPlugin' not in already_processed: 1346 already_processed.add('matrixPlugin') 1347 showIndent(outfile, level) 1348 outfile.write('matrixPlugin="%s",\n' % (self.matrixPlugin,)) 1349 def exportLiteralChildren(self, outfile, level, name_): 1350 pass 1351 def build(self, node): 1352 already_processed = set() 1353 self.buildAttributes(node, node.attrib, already_processed) 1354 for child in node: 1355 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1356 self.buildChildren(child, node, nodeName_) 1357 return self 1358 def buildAttributes(self, node, attrs, already_processed): 1359 value = find_attr_value_('matrixPlugin', node) 1360 if value is not None and 'matrixPlugin' not in already_processed: 1361 already_processed.add('matrixPlugin') 1362 self.matrixPlugin = value 1363 self.validate_pluginType(self.matrixPlugin) # validate type pluginType 1364 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1365 pass 1366# end class matrixPlugin 1367 1368 1369class matrixFile(GeneratedsSuper): 1370 subclass = None 1371 superclass = None 1372 def __init__(self, matrixFile=None): 1373 self.matrixFile = _cast(None, matrixFile) 1374 pass 1375 def factory(*args_, **kwargs_): 1376 if matrixFile.subclass: 1377 return matrixFile.subclass(*args_, **kwargs_) 1378 else: 1379 return matrixFile(*args_, **kwargs_) 1380 factory = staticmethod(factory) 1381 def get_matrixFile(self): return self.matrixFile 1382 def set_matrixFile(self, matrixFile): self.matrixFile = matrixFile 1383 def hasContent_(self): 1384 if ( 1385 1386 ): 1387 return True 1388 else: 1389 return False 1390 def export(self, outfile, level, namespace_='', name_='matrixFile', namespacedef_='', pretty_print=True): 1391 if pretty_print: 1392 eol_ = '\n' 1393 else: 1394 eol_ = '' 1395 showIndent(outfile, level, pretty_print) 1396 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1397 already_processed = set() 1398 self.exportAttributes(outfile, level, already_processed, namespace_, name_='matrixFile') 1399 if self.hasContent_(): 1400 outfile.write('>%s' % (eol_, )) 1401 self.exportChildren(outfile, level + 1, namespace_='', name_='matrixFile', pretty_print=pretty_print) 1402 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1403 else: 1404 outfile.write('/>%s' % (eol_, )) 1405 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='matrixFile'): 1406 if self.matrixFile is not None and 'matrixFile' not in already_processed: 1407 already_processed.add('matrixFile') 1408 outfile.write(' matrixFile=%s' % (self.gds_format_string(quote_attrib(self.matrixFile).encode(ExternalEncoding), input_name='matrixFile'), )) 1409 def exportChildren(self, outfile, level, namespace_='', name_='matrixFile', fromsubclass_=False, pretty_print=True): 1410 pass 1411 def exportLiteral(self, outfile, level, name_='matrixFile'): 1412 level += 1 1413 already_processed = set() 1414 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1415 if self.hasContent_(): 1416 self.exportLiteralChildren(outfile, level, name_) 1417 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1418 if self.matrixFile is not None and 'matrixFile' not in already_processed: 1419 already_processed.add('matrixFile') 1420 showIndent(outfile, level) 1421 outfile.write('matrixFile="%s",\n' % (self.matrixFile,)) 1422 def exportLiteralChildren(self, outfile, level, name_): 1423 pass 1424 def build(self, node): 1425 already_processed = set() 1426 self.buildAttributes(node, node.attrib, already_processed) 1427 for child in node: 1428 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1429 self.buildChildren(child, node, nodeName_) 1430 return self 1431 def buildAttributes(self, node, attrs, already_processed): 1432 value = find_attr_value_('matrixFile', node) 1433 if value is not None and 'matrixFile' not in already_processed: 1434 already_processed.add('matrixFile') 1435 self.matrixFile = value 1436 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1437 pass 1438# end class matrixFile 1439 1440 1441class OSI(GeneratedsSuper): 1442 subclass = None 1443 superclass = None 1444 def __init__(self, DS_Concerned=None, Interactions_Concerned=None, extensiontype_=None): 1445 self.DS_Concerned = DS_Concerned 1446 self.Interactions_Concerned = Interactions_Concerned 1447 self.extensiontype_ = extensiontype_ 1448 def factory(*args_, **kwargs_): 1449 if OSI.subclass: 1450 return OSI.subclass(*args_, **kwargs_) 1451 else: 1452 return OSI(*args_, **kwargs_) 1453 factory = staticmethod(factory) 1454 def get_DS_Concerned(self): return self.DS_Concerned 1455 def set_DS_Concerned(self, DS_Concerned): self.DS_Concerned = DS_Concerned 1456 def get_Interactions_Concerned(self): return self.Interactions_Concerned 1457 def set_Interactions_Concerned(self, Interactions_Concerned): self.Interactions_Concerned = Interactions_Concerned 1458 def get_extensiontype_(self): return self.extensiontype_ 1459 def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ 1460 def validate_strList(self, value): 1461 # Validate type strList, a restriction on xsd:string. 1462 pass 1463 def hasContent_(self): 1464 if ( 1465 self.DS_Concerned is not None or 1466 self.Interactions_Concerned is not None 1467 ): 1468 return True 1469 else: 1470 return False 1471 def export(self, outfile, level, namespace_='', name_='OSI', namespacedef_='', pretty_print=True): 1472 if pretty_print: 1473 eol_ = '\n' 1474 else: 1475 eol_ = '' 1476 showIndent(outfile, level, pretty_print) 1477 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1478 already_processed = set() 1479 self.exportAttributes(outfile, level, already_processed, namespace_, name_='OSI') 1480 if self.hasContent_(): 1481 outfile.write('>%s' % (eol_, )) 1482 self.exportChildren(outfile, level + 1, namespace_='', name_='OSI', pretty_print=pretty_print) 1483 showIndent(outfile, level, pretty_print) 1484 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1485 else: 1486 outfile.write('/>%s' % (eol_, )) 1487 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OSI'): 1488 if self.extensiontype_ is not None and 'xsi:type' not in already_processed: 1489 already_processed.add('xsi:type') 1490 outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') 1491 outfile.write(' xsi:type="%s"' % self.extensiontype_) 1492 pass 1493 def exportChildren(self, outfile, level, namespace_='', name_='OSI', fromsubclass_=False, pretty_print=True): 1494 if pretty_print: 1495 eol_ = '\n' 1496 else: 1497 eol_ = '' 1498 if self.DS_Concerned is not None: 1499 showIndent(outfile, level, pretty_print) 1500 outfile.write('<%sDS_Concerned>%s</%sDS_Concerned>%s' % (namespace_, self.gds_format_string(quote_xml(' '.join(self.DS_Concerned)).encode(ExternalEncoding), input_name='DS_Concerned'), namespace_, eol_)) 1501 if self.Interactions_Concerned is not None: 1502 showIndent(outfile, level, pretty_print) 1503 outfile.write('<%sInteractions_Concerned>%s</%sInteractions_Concerned>%s' % (namespace_, self.gds_format_string(quote_xml(' '.join(self.Interactions_Concerned)).encode(ExternalEncoding), input_name='Interactions_Concerned'), namespace_, eol_)) 1504 def exportLiteral(self, outfile, level, name_='OSI'): 1505 level += 1 1506 already_processed = set() 1507 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1508 if self.hasContent_(): 1509 self.exportLiteralChildren(outfile, level, name_) 1510 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1511 pass 1512 def exportLiteralChildren(self, outfile, level, name_): 1513 if self.DS_Concerned is not None: 1514 showIndent(outfile, level) 1515 if self.DS_Concerned: 1516 outfile.write('DS_Concerned=%s,\n' % quote_python(' '.join(self.DS_Concerned)).encode(ExternalEncoding)) 1517 else: 1518 outfile.write('DS_Concerned=None,\n') 1519 if self.Interactions_Concerned is not None: 1520 showIndent(outfile, level) 1521 if self.Interactions_Concerned: 1522 outfile.write('Interactions_Concerned=%s,\n' % quote_python(' '.join(self.Interactions_Concerned)).encode(ExternalEncoding)) 1523 else: 1524 outfile.write('Interactions_Concerned=None,\n') 1525 def build(self, node): 1526 already_processed = set() 1527 self.buildAttributes(node, node.attrib, already_processed) 1528 for child in node: 1529 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1530 self.buildChildren(child, node, nodeName_) 1531 return self 1532 def buildAttributes(self, node, attrs, already_processed): 1533 value = find_attr_value_('xsi:type', node) 1534 if value is not None and 'xsi:type' not in already_processed: 1535 already_processed.add('xsi:type') 1536 self.extensiontype_ = value 1537 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1538 if nodeName_ == 'DS_Concerned': 1539 DS_Concerned_ = child_.text 1540 self.DS_Concerned = DS_Concerned_ 1541 self.DS_Concerned = self.DS_Concerned.split() 1542 self.validate_strList(self.DS_Concerned) # validate type strList 1543 elif nodeName_ == 'Interactions_Concerned': 1544 Interactions_Concerned_ = child_.text 1545 self.Interactions_Concerned = Interactions_Concerned_ 1546 self.Interactions_Concerned = self.Interactions_Concerned.split() 1547 self.validate_strList(self.Interactions_Concerned) # validate type strList 1548# end class OSI 1549 1550 1551class NSL(GeneratedsSuper): 1552 subclass = None 1553 superclass = None 1554 def __init__(self, size=None, extensiontype_=None): 1555 self.size = _cast(int, size) 1556 self.extensiontype_ = extensiontype_ 1557 def factory(*args_, **kwargs_): 1558 if NSL.subclass: 1559 return NSL.subclass(*args_, **kwargs_) 1560 else: 1561 return NSL(*args_, **kwargs_) 1562 factory = staticmethod(factory) 1563 def get_size(self): return self.size 1564 def set_size(self, size): self.size = size 1565 def get_extensiontype_(self): return self.extensiontype_ 1566 def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ 1567 def hasContent_(self): 1568 if ( 1569 1570 ): 1571 return True 1572 else: 1573 return False 1574 def export(self, outfile, level, namespace_='', name_='NSL', namespacedef_='', pretty_print=True): 1575 if pretty_print: 1576 eol_ = '\n' 1577 else: 1578 eol_ = '' 1579 showIndent(outfile, level, pretty_print) 1580 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1581 already_processed = set() 1582 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NSL') 1583 if self.hasContent_(): 1584 outfile.write('>%s' % (eol_, )) 1585 self.exportChildren(outfile, level + 1, namespace_='', name_='NSL', pretty_print=pretty_print) 1586 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1587 else: 1588 outfile.write('/>%s' % (eol_, )) 1589 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NSL'): 1590 if self.size is not None and 'size' not in already_processed: 1591 already_processed.add('size') 1592 outfile.write(' size="%s"' % self.gds_format_integer(self.size, input_name='size')) 1593 if self.extensiontype_ is not None and 'xsi:type' not in already_processed: 1594 already_processed.add('xsi:type') 1595 outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') 1596 outfile.write(' xsi:type="%s"' % self.extensiontype_) 1597 def exportChildren(self, outfile, level, namespace_='', name_='NSL', fromsubclass_=False, pretty_print=True): 1598 pass 1599 def exportLiteral(self, outfile, level, name_='NSL'): 1600 level += 1 1601 already_processed = set() 1602 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1603 if self.hasContent_(): 1604 self.exportLiteralChildren(outfile, level, name_) 1605 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1606 if self.size is not None and 'size' not in already_processed: 1607 already_processed.add('size') 1608 showIndent(outfile, level) 1609 outfile.write('size=%d,\n' % (self.size,)) 1610 def exportLiteralChildren(self, outfile, level, name_): 1611 pass 1612 def build(self, node): 1613 already_processed = set() 1614 self.buildAttributes(node, node.attrib, already_processed) 1615 for child in node: 1616 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1617 self.buildChildren(child, node, nodeName_) 1618 return self 1619 def buildAttributes(self, node, attrs, already_processed): 1620 value = find_attr_value_('size', node) 1621 if value is not None and 'size' not in already_processed: 1622 already_processed.add('size') 1623 try: 1624 self.size = int(value) 1625 except ValueError as exp: 1626 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1627 if self.size <= 0: 1628 raise_parse_error(node, 'Invalid PositiveInteger') 1629 value = find_attr_value_('xsi:type', node) 1630 if value is not None and 'xsi:type' not in already_processed: 1631 already_processed.add('xsi:type') 1632 self.extensiontype_ = value 1633 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1634 pass 1635# end class NSL 1636 1637 1638class OSNSP(GeneratedsSuper): 1639 subclass = None 1640 superclass = None 1641 def __init__(self, StorageType=None, Id=None, NonSmoothSolver=None, extensiontype_=None): 1642 self.StorageType = _cast(int, StorageType) 1643 self.Id = _cast(None, Id) 1644 self.NonSmoothSolver = NonSmoothSolver 1645 self.extensiontype_ = extensiontype_ 1646 def factory(*args_, **kwargs_): 1647 if OSNSP.subclass: 1648 return OSNSP.subclass(*args_, **kwargs_) 1649 else: 1650 return OSNSP(*args_, **kwargs_) 1651 factory = staticmethod(factory) 1652 def get_NonSmoothSolver(self): return self.NonSmoothSolver 1653 def set_NonSmoothSolver(self, NonSmoothSolver): self.NonSmoothSolver = NonSmoothSolver 1654 def get_StorageType(self): return self.StorageType 1655 def set_StorageType(self, StorageType): self.StorageType = StorageType 1656 def get_Id(self): return self.Id 1657 def set_Id(self, Id): self.Id = Id 1658 def get_extensiontype_(self): return self.extensiontype_ 1659 def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ 1660 def hasContent_(self): 1661 if ( 1662 self.NonSmoothSolver is not None 1663 ): 1664 return True 1665 else: 1666 return False 1667 def export(self, outfile, level, namespace_='', name_='OSNSP', namespacedef_='', pretty_print=True): 1668 if pretty_print: 1669 eol_ = '\n' 1670 else: 1671 eol_ = '' 1672 showIndent(outfile, level, pretty_print) 1673 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1674 already_processed = set() 1675 self.exportAttributes(outfile, level, already_processed, namespace_, name_='OSNSP') 1676 if self.hasContent_(): 1677 outfile.write('>%s' % (eol_, )) 1678 self.exportChildren(outfile, level + 1, namespace_='', name_='OSNSP', pretty_print=pretty_print) 1679 showIndent(outfile, level, pretty_print) 1680 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1681 else: 1682 outfile.write('/>%s' % (eol_, )) 1683 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OSNSP'): 1684 if self.StorageType is not None and 'StorageType' not in already_processed: 1685 already_processed.add('StorageType') 1686 outfile.write(' StorageType="%s"' % self.gds_format_integer(self.StorageType, input_name='StorageType')) 1687 if self.Id is not None and 'Id' not in already_processed: 1688 already_processed.add('Id') 1689 outfile.write(' Id=%s' % (self.gds_format_string(quote_attrib(self.Id).encode(ExternalEncoding), input_name='Id'), )) 1690 if self.extensiontype_ is not None and 'xsi:type' not in already_processed: 1691 already_processed.add('xsi:type') 1692 outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') 1693 outfile.write(' xsi:type="%s"' % self.extensiontype_) 1694 def exportChildren(self, outfile, level, namespace_='', name_='OSNSP', fromsubclass_=False, pretty_print=True): 1695 if pretty_print: 1696 eol_ = '\n' 1697 else: 1698 eol_ = '' 1699 if self.NonSmoothSolver is not None: 1700 self.NonSmoothSolver.export(outfile, level, namespace_, name_='NonSmoothSolver', pretty_print=pretty_print) 1701 def exportLiteral(self, outfile, level, name_='OSNSP'): 1702 level += 1 1703 already_processed = set() 1704 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1705 if self.hasContent_(): 1706 self.exportLiteralChildren(outfile, level, name_) 1707 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1708 if self.StorageType is not None and 'StorageType' not in already_processed: 1709 already_processed.add('StorageType') 1710 showIndent(outfile, level) 1711 outfile.write('StorageType=%d,\n' % (self.StorageType,)) 1712 if self.Id is not None and 'Id' not in already_processed: 1713 already_processed.add('Id') 1714 showIndent(outfile, level) 1715 outfile.write('Id="%s",\n' % (self.Id,)) 1716 def exportLiteralChildren(self, outfile, level, name_): 1717 if self.NonSmoothSolver is not None: 1718 showIndent(outfile, level) 1719 outfile.write('NonSmoothSolver=model_.NonSmoothSolver(\n') 1720 self.NonSmoothSolver.exportLiteral(outfile, level) 1721 showIndent(outfile, level) 1722 outfile.write('),\n') 1723 def build(self, node): 1724 already_processed = set() 1725 self.buildAttributes(node, node.attrib, already_processed) 1726 for child in node: 1727 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1728 self.buildChildren(child, node, nodeName_) 1729 return self 1730 def buildAttributes(self, node, attrs, already_processed): 1731 value = find_attr_value_('StorageType', node) 1732 if value is not None and 'StorageType' not in already_processed: 1733 already_processed.add('StorageType') 1734 try: 1735 self.StorageType = int(value) 1736 except ValueError as exp: 1737 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 1738 if self.StorageType < 0: 1739 raise_parse_error(node, 'Invalid NonNegativeInteger') 1740 value = find_attr_value_('Id', node) 1741 if value is not None and 'Id' not in already_processed: 1742 already_processed.add('Id') 1743 self.Id = value 1744 value = find_attr_value_('xsi:type', node) 1745 if value is not None and 'xsi:type' not in already_processed: 1746 already_processed.add('xsi:type') 1747 self.extensiontype_ = value 1748 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1749 if nodeName_ == 'NonSmoothSolver': 1750 obj_ = NonSmoothSolver.factory() 1751 obj_.build(child_) 1752 self.NonSmoothSolver = obj_ 1753# end class OSNSP 1754 1755 1756class ModelTime(GeneratedsSuper): 1757 subclass = None 1758 superclass = None 1759 def __init__(self, t0=None, T=None): 1760 self.t0 = t0 1761 self.T = T 1762 def factory(*args_, **kwargs_): 1763 if ModelTime.subclass: 1764 return ModelTime.subclass(*args_, **kwargs_) 1765 else: 1766 return ModelTime(*args_, **kwargs_) 1767 factory = staticmethod(factory) 1768 def get_t0(self): return self.t0 1769 def set_t0(self, t0): self.t0 = t0 1770 def get_T(self): return self.T 1771 def set_T(self, T): self.T = T 1772 def validate_positiveDouble(self, value): 1773 # Validate type positiveDouble, a restriction on xsd:double. 1774 pass 1775 def hasContent_(self): 1776 if ( 1777 self.t0 is not None or 1778 self.T is not None 1779 ): 1780 return True 1781 else: 1782 return False 1783 def export(self, outfile, level, namespace_='', name_='ModelTime', namespacedef_='', pretty_print=True): 1784 if pretty_print: 1785 eol_ = '\n' 1786 else: 1787 eol_ = '' 1788 showIndent(outfile, level, pretty_print) 1789 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1790 already_processed = set() 1791 self.exportAttributes(outfile, level, already_processed, namespace_, name_='ModelTime') 1792 if self.hasContent_(): 1793 outfile.write('>%s' % (eol_, )) 1794 self.exportChildren(outfile, level + 1, namespace_='', name_='ModelTime', pretty_print=pretty_print) 1795 showIndent(outfile, level, pretty_print) 1796 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1797 else: 1798 outfile.write('/>%s' % (eol_, )) 1799 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ModelTime'): 1800 pass 1801 def exportChildren(self, outfile, level, namespace_='', name_='ModelTime', fromsubclass_=False, pretty_print=True): 1802 if pretty_print: 1803 eol_ = '\n' 1804 else: 1805 eol_ = '' 1806 if self.t0 is not None: 1807 showIndent(outfile, level, pretty_print) 1808 outfile.write('<%st0>%s</%st0>%s' % (namespace_, self.gds_format_double(self.t0, input_name='t0'), namespace_, eol_)) 1809 if self.T is not None: 1810 showIndent(outfile, level, pretty_print) 1811 outfile.write('<%sT>%s</%sT>%s' % (namespace_, self.gds_format_double(self.T, input_name='T'), namespace_, eol_)) 1812 def exportLiteral(self, outfile, level, name_='ModelTime'): 1813 level += 1 1814 already_processed = set() 1815 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1816 if self.hasContent_(): 1817 self.exportLiteralChildren(outfile, level, name_) 1818 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1819 pass 1820 def exportLiteralChildren(self, outfile, level, name_): 1821 if self.t0 is not None: 1822 showIndent(outfile, level) 1823 outfile.write('t0=%e,\n' % self.t0) 1824 if self.T is not None: 1825 showIndent(outfile, level) 1826 outfile.write('T=%e,\n' % self.T) 1827 def build(self, node): 1828 already_processed = set() 1829 self.buildAttributes(node, node.attrib, already_processed) 1830 for child in node: 1831 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1832 self.buildChildren(child, node, nodeName_) 1833 return self 1834 def buildAttributes(self, node, attrs, already_processed): 1835 pass 1836 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1837 if nodeName_ == 't0': 1838 sval_ = child_.text 1839 try: 1840 fval_ = float(sval_) 1841 except (TypeError, ValueError) as exp: 1842 raise_parse_error(child_, 'requires float or double: %s' % exp) 1843 fval_ = self.gds_validate_float(fval_, node, 't0') 1844 self.t0 = fval_ 1845 self.validate_positiveDouble(self.t0) # validate type positiveDouble 1846 elif nodeName_ == 'T': 1847 sval_ = child_.text 1848 try: 1849 fval_ = float(sval_) 1850 except (TypeError, ValueError) as exp: 1851 raise_parse_error(child_, 'requires float or double: %s' % exp) 1852 fval_ = self.gds_validate_float(fval_, node, 'T') 1853 self.T = fval_ 1854 self.validate_positiveDouble(self.T) # validate type positiveDouble 1855# end class ModelTime 1856 1857 1858class BoundaryCondition(GeneratedsSuper): 1859 subclass = None 1860 superclass = None 1861 def __init__(self, Linear=None, NLinear=None, Periodic=None): 1862 self.Linear = Linear 1863 self.NLinear = NLinear 1864 self.Periodic = Periodic 1865 def factory(*args_, **kwargs_): 1866 if BoundaryCondition.subclass: 1867 return BoundaryCondition.subclass(*args_, **kwargs_) 1868 else: 1869 return BoundaryCondition(*args_, **kwargs_) 1870 factory = staticmethod(factory) 1871 def get_Linear(self): return self.Linear 1872 def set_Linear(self, Linear): self.Linear = Linear 1873 def get_NLinear(self): return self.NLinear 1874 def set_NLinear(self, NLinear): self.NLinear = NLinear 1875 def get_Periodic(self): return self.Periodic 1876 def set_Periodic(self, Periodic): self.Periodic = Periodic 1877 def hasContent_(self): 1878 if ( 1879 self.Linear is not None or 1880 self.NLinear is not None or 1881 self.Periodic is not None 1882 ): 1883 return True 1884 else: 1885 return False 1886 def export(self, outfile, level, namespace_='', name_='BoundaryCondition', namespacedef_='', pretty_print=True): 1887 if pretty_print: 1888 eol_ = '\n' 1889 else: 1890 eol_ = '' 1891 showIndent(outfile, level, pretty_print) 1892 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 1893 already_processed = set() 1894 self.exportAttributes(outfile, level, already_processed, namespace_, name_='BoundaryCondition') 1895 if self.hasContent_(): 1896 outfile.write('>%s' % (eol_, )) 1897 self.exportChildren(outfile, level + 1, namespace_='', name_='BoundaryCondition', pretty_print=pretty_print) 1898 showIndent(outfile, level, pretty_print) 1899 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 1900 else: 1901 outfile.write('/>%s' % (eol_, )) 1902 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BoundaryCondition'): 1903 pass 1904 def exportChildren(self, outfile, level, namespace_='', name_='BoundaryCondition', fromsubclass_=False, pretty_print=True): 1905 if pretty_print: 1906 eol_ = '\n' 1907 else: 1908 eol_ = '' 1909 if self.Linear is not None: 1910 self.Linear.export(outfile, level, namespace_, name_='Linear', pretty_print=pretty_print) 1911 if self.NLinear is not None: 1912 self.NLinear.export(outfile, level, namespace_, name_='NLinear', pretty_print=pretty_print) 1913 if self.Periodic is not None: 1914 self.Periodic.export(outfile, level, namespace_, name_='Periodic', pretty_print=pretty_print) 1915 def exportLiteral(self, outfile, level, name_='BoundaryCondition'): 1916 level += 1 1917 already_processed = set() 1918 self.exportLiteralAttributes(outfile, level, already_processed, name_) 1919 if self.hasContent_(): 1920 self.exportLiteralChildren(outfile, level, name_) 1921 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 1922 pass 1923 def exportLiteralChildren(self, outfile, level, name_): 1924 if self.Linear is not None: 1925 showIndent(outfile, level) 1926 outfile.write('Linear=model_.LinearType(\n') 1927 self.Linear.exportLiteral(outfile, level, name_='Linear') 1928 showIndent(outfile, level) 1929 outfile.write('),\n') 1930 if self.NLinear is not None: 1931 showIndent(outfile, level) 1932 outfile.write('NLinear=model_.NLinearType(\n') 1933 self.NLinear.exportLiteral(outfile, level, name_='NLinear') 1934 showIndent(outfile, level) 1935 outfile.write('),\n') 1936 if self.Periodic is not None: 1937 showIndent(outfile, level) 1938 outfile.write('Periodic=model_.PeriodicType(\n') 1939 self.Periodic.exportLiteral(outfile, level, name_='Periodic') 1940 showIndent(outfile, level) 1941 outfile.write('),\n') 1942 def build(self, node): 1943 already_processed = set() 1944 self.buildAttributes(node, node.attrib, already_processed) 1945 for child in node: 1946 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 1947 self.buildChildren(child, node, nodeName_) 1948 return self 1949 def buildAttributes(self, node, attrs, already_processed): 1950 pass 1951 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 1952 if nodeName_ == 'Linear': 1953 obj_ = LinearType.factory() 1954 obj_.build(child_) 1955 self.Linear = obj_ 1956 elif nodeName_ == 'NLinear': 1957 obj_ = NLinearType.factory() 1958 obj_.build(child_) 1959 self.NLinear = obj_ 1960 elif nodeName_ == 'Periodic': 1961 obj_ = PeriodicType.factory() 1962 obj_.build(child_) 1963 self.Periodic = obj_ 1964# end class BoundaryCondition 1965 1966 1967class NonSmoothSolver(GeneratedsSuper): 1968 subclass = None 1969 superclass = None 1970 def __init__(self, Name=None, iparam=None, dparam=None): 1971 self.Name = _cast(None, Name) 1972 self.iparam = iparam 1973 self.dparam = dparam 1974 def factory(*args_, **kwargs_): 1975 if NonSmoothSolver.subclass: 1976 return NonSmoothSolver.subclass(*args_, **kwargs_) 1977 else: 1978 return NonSmoothSolver(*args_, **kwargs_) 1979 factory = staticmethod(factory) 1980 def get_iparam(self): return self.iparam 1981 def set_iparam(self, iparam): self.iparam = iparam 1982 def get_dparam(self): return self.dparam 1983 def set_dparam(self, dparam): self.dparam = dparam 1984 def get_Name(self): return self.Name 1985 def set_Name(self, Name): self.Name = Name 1986 def hasContent_(self): 1987 if ( 1988 self.iparam is not None or 1989 self.dparam is not None 1990 ): 1991 return True 1992 else: 1993 return False 1994 def export(self, outfile, level, namespace_='', name_='NonSmoothSolver', namespacedef_='', pretty_print=True): 1995 if pretty_print: 1996 eol_ = '\n' 1997 else: 1998 eol_ = '' 1999 showIndent(outfile, level, pretty_print) 2000 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2001 already_processed = set() 2002 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NonSmoothSolver') 2003 if self.hasContent_(): 2004 outfile.write('>%s' % (eol_, )) 2005 self.exportChildren(outfile, level + 1, namespace_='', name_='NonSmoothSolver', pretty_print=pretty_print) 2006 showIndent(outfile, level, pretty_print) 2007 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2008 else: 2009 outfile.write('/>%s' % (eol_, )) 2010 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NonSmoothSolver'): 2011 if self.Name is not None and 'Name' not in already_processed: 2012 already_processed.add('Name') 2013 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 2014 def exportChildren(self, outfile, level, namespace_='', name_='NonSmoothSolver', fromsubclass_=False, pretty_print=True): 2015 if pretty_print: 2016 eol_ = '\n' 2017 else: 2018 eol_ = '' 2019 if self.iparam is not None: 2020 self.iparam.export(outfile, level, namespace_, name_='iparam', pretty_print=pretty_print) 2021 if self.dparam is not None: 2022 self.dparam.export(outfile, level, namespace_, name_='dparam', pretty_print=pretty_print) 2023 def exportLiteral(self, outfile, level, name_='NonSmoothSolver'): 2024 level += 1 2025 already_processed = set() 2026 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2027 if self.hasContent_(): 2028 self.exportLiteralChildren(outfile, level, name_) 2029 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2030 if self.Name is not None and 'Name' not in already_processed: 2031 already_processed.add('Name') 2032 showIndent(outfile, level) 2033 outfile.write('Name="%s",\n' % (self.Name,)) 2034 def exportLiteralChildren(self, outfile, level, name_): 2035 if self.iparam is not None: 2036 showIndent(outfile, level) 2037 outfile.write('iparam=model_.vector(\n') 2038 self.iparam.exportLiteral(outfile, level, name_='iparam') 2039 showIndent(outfile, level) 2040 outfile.write('),\n') 2041 if self.dparam is not None: 2042 showIndent(outfile, level) 2043 outfile.write('dparam=model_.vector(\n') 2044 self.dparam.exportLiteral(outfile, level, name_='dparam') 2045 showIndent(outfile, level) 2046 outfile.write('),\n') 2047 def build(self, node): 2048 already_processed = set() 2049 self.buildAttributes(node, node.attrib, already_processed) 2050 for child in node: 2051 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2052 self.buildChildren(child, node, nodeName_) 2053 return self 2054 def buildAttributes(self, node, attrs, already_processed): 2055 value = find_attr_value_('Name', node) 2056 if value is not None and 'Name' not in already_processed: 2057 already_processed.add('Name') 2058 self.Name = value 2059 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2060 if nodeName_ == 'iparam': 2061 obj_ = vector.factory() 2062 obj_.build(child_) 2063 self.iparam = obj_ 2064 elif nodeName_ == 'dparam': 2065 obj_ = vector.factory() 2066 obj_.build(child_) 2067 self.dparam = obj_ 2068# end class NonSmoothSolver 2069 2070 2071class index_list(GeneratedsSuper): 2072 subclass = None 2073 superclass = None 2074 def __init__(self, all='false', indexList=None): 2075 self.all = _cast(None, all) 2076 if indexList is None: 2077 self.indexList = [] 2078 else: 2079 self.indexList = indexList 2080 def factory(*args_, **kwargs_): 2081 if index_list.subclass: 2082 return index_list.subclass(*args_, **kwargs_) 2083 else: 2084 return index_list(*args_, **kwargs_) 2085 factory = staticmethod(factory) 2086 def get_indexList(self): return self.indexList 2087 def set_indexList(self, indexList): self.indexList = indexList 2088 def add_indexList(self, value): self.indexList.append(value) 2089 def insert_indexList(self, index, value): self.indexList[index] = value 2090 def get_all(self): return self.all 2091 def set_all(self, all): self.all = all 2092 def validate_boolean(self, value): 2093 # Validate type boolean, a restriction on xsd:boolean. 2094 pass 2095 def hasContent_(self): 2096 if ( 2097 self.indexList 2098 ): 2099 return True 2100 else: 2101 return False 2102 def export(self, outfile, level, namespace_='', name_='index_list', namespacedef_='', pretty_print=True): 2103 if pretty_print: 2104 eol_ = '\n' 2105 else: 2106 eol_ = '' 2107 showIndent(outfile, level, pretty_print) 2108 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2109 already_processed = set() 2110 self.exportAttributes(outfile, level, already_processed, namespace_, name_='index_list') 2111 if self.hasContent_(): 2112 outfile.write('>%s' % (eol_, )) 2113 self.exportChildren(outfile, level + 1, namespace_='', name_='index_list', pretty_print=pretty_print) 2114 showIndent(outfile, level, pretty_print) 2115 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2116 else: 2117 outfile.write('/>%s' % (eol_, )) 2118 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='index_list'): 2119 if self.all is not None and 'all' not in already_processed: 2120 already_processed.add('all') 2121 outfile.write(' all=%s' % (quote_attrib(self.all), )) 2122 def exportChildren(self, outfile, level, namespace_='', name_='index_list', fromsubclass_=False, pretty_print=True): 2123 if pretty_print: 2124 eol_ = '\n' 2125 else: 2126 eol_ = '' 2127 for indexList_ in self.indexList: 2128 indexList_.export(outfile, level, namespace_, name_='indexList', pretty_print=pretty_print) 2129 def exportLiteral(self, outfile, level, name_='index_list'): 2130 level += 1 2131 already_processed = set() 2132 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2133 if self.hasContent_(): 2134 self.exportLiteralChildren(outfile, level, name_) 2135 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2136 if self.all is not None and 'all' not in already_processed: 2137 already_processed.add('all') 2138 showIndent(outfile, level) 2139 outfile.write('all=%s,\n' % (self.all,)) 2140 def exportLiteralChildren(self, outfile, level, name_): 2141 showIndent(outfile, level) 2142 outfile.write('indexList=[\n') 2143 level += 1 2144 for indexList_ in self.indexList: 2145 showIndent(outfile, level) 2146 outfile.write('model_.vector(\n') 2147 indexList_.exportLiteral(outfile, level, name_='vector') 2148 showIndent(outfile, level) 2149 outfile.write('),\n') 2150 level -= 1 2151 showIndent(outfile, level) 2152 outfile.write('],\n') 2153 def build(self, node): 2154 already_processed = set() 2155 self.buildAttributes(node, node.attrib, already_processed) 2156 for child in node: 2157 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2158 self.buildChildren(child, node, nodeName_) 2159 return self 2160 def buildAttributes(self, node, attrs, already_processed): 2161 value = find_attr_value_('all', node) 2162 if value is not None and 'all' not in already_processed: 2163 already_processed.add('all') 2164 if value in ('true', '1'): 2165 self.all = True 2166 elif value in ('false', '0'): 2167 self.all = False 2168 else: 2169 raise_parse_error(node, 'Bad boolean attribute') 2170 self.validate_boolean(self.all) # validate type boolean 2171 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2172 if nodeName_ == 'indexList': 2173 obj_ = vector.factory() 2174 obj_.build(child_) 2175 self.indexList.append(obj_) 2176# end class index_list 2177 2178 2179class SiconosModel(GeneratedsSuper): 2180 subclass = None 2181 superclass = None 2182 def __init__(self, Title=None, Author=None, Description=None, Date=None, SchemaXML=None, Time=None, NSDS=None, Simulation=None): 2183 self.Title = Title 2184 self.Author = Author 2185 self.Description = Description 2186 self.Date = Date 2187 self.SchemaXML = SchemaXML 2188 self.Time = Time 2189 self.NSDS = NSDS 2190 self.Simulation = Simulation 2191 def factory(*args_, **kwargs_): 2192 if SiconosModel.subclass: 2193 return SiconosModel.subclass(*args_, **kwargs_) 2194 else: 2195 return SiconosModel(*args_, **kwargs_) 2196 factory = staticmethod(factory) 2197 def get_Title(self): return self.Title 2198 def set_Title(self, Title): self.Title = Title 2199 def get_Author(self): return self.Author 2200 def set_Author(self, Author): self.Author = Author 2201 def get_Description(self): return self.Description 2202 def set_Description(self, Description): self.Description = Description 2203 def get_Date(self): return self.Date 2204 def set_Date(self, Date): self.Date = Date 2205 def get_SchemaXML(self): return self.SchemaXML 2206 def set_SchemaXML(self, SchemaXML): self.SchemaXML = SchemaXML 2207 def get_Time(self): return self.Time 2208 def set_Time(self, Time): self.Time = Time 2209 def get_NSDS(self): return self.NSDS 2210 def set_NSDS(self, NSDS): self.NSDS = NSDS 2211 def get_Simulation(self): return self.Simulation 2212 def set_Simulation(self, Simulation): self.Simulation = Simulation 2213 def hasContent_(self): 2214 if ( 2215 self.Title is not None or 2216 self.Author is not None or 2217 self.Description is not None or 2218 self.Date is not None or 2219 self.SchemaXML is not None or 2220 self.Time is not None or 2221 self.NSDS is not None or 2222 self.Simulation is not None 2223 ): 2224 return True 2225 else: 2226 return False 2227 def export(self, outfile, level, namespace_='', name_='SiconosModel', namespacedef_='', pretty_print=True): 2228 if pretty_print: 2229 eol_ = '\n' 2230 else: 2231 eol_ = '' 2232 showIndent(outfile, level, pretty_print) 2233 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2234 already_processed = set() 2235 self.exportAttributes(outfile, level, already_processed, namespace_, name_='SiconosModel') 2236 if self.hasContent_(): 2237 outfile.write('>%s' % (eol_, )) 2238 self.exportChildren(outfile, level + 1, namespace_='', name_='SiconosModel', pretty_print=pretty_print) 2239 showIndent(outfile, level, pretty_print) 2240 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2241 else: 2242 outfile.write('/>%s' % (eol_, )) 2243 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SiconosModel'): 2244 pass 2245 def exportChildren(self, outfile, level, namespace_='', name_='SiconosModel', fromsubclass_=False, pretty_print=True): 2246 if pretty_print: 2247 eol_ = '\n' 2248 else: 2249 eol_ = '' 2250 if self.Title is not None: 2251 showIndent(outfile, level, pretty_print) 2252 outfile.write('<%sTitle>%s</%sTitle>%s' % (namespace_, self.gds_format_string(quote_xml(self.Title).encode(ExternalEncoding), input_name='Title'), namespace_, eol_)) 2253 if self.Author is not None: 2254 showIndent(outfile, level, pretty_print) 2255 outfile.write('<%sAuthor>%s</%sAuthor>%s' % (namespace_, self.gds_format_string(quote_xml(self.Author).encode(ExternalEncoding), input_name='Author'), namespace_, eol_)) 2256 if self.Description is not None: 2257 showIndent(outfile, level, pretty_print) 2258 outfile.write('<%sDescription>%s</%sDescription>%s' % (namespace_, self.gds_format_string(quote_xml(self.Description).encode(ExternalEncoding), input_name='Description'), namespace_, eol_)) 2259 if self.Date is not None: 2260 showIndent(outfile, level, pretty_print) 2261 outfile.write('<%sDate>%s</%sDate>%s' % (namespace_, self.gds_format_string(quote_xml(self.Date).encode(ExternalEncoding), input_name='Date'), namespace_, eol_)) 2262 if self.SchemaXML is not None: 2263 showIndent(outfile, level, pretty_print) 2264 outfile.write('<%sSchemaXML>%s</%sSchemaXML>%s' % (namespace_, self.gds_format_string(quote_xml(self.SchemaXML).encode(ExternalEncoding), input_name='SchemaXML'), namespace_, eol_)) 2265 if self.Time is not None: 2266 self.Time.export(outfile, level, namespace_, name_='Time', pretty_print=pretty_print) 2267 if self.NSDS is not None: 2268 self.NSDS.export(outfile, level, namespace_, name_='NSDS', pretty_print=pretty_print) 2269 if self.Simulation is not None: 2270 self.Simulation.export(outfile, level, namespace_, name_='Simulation', pretty_print=pretty_print) 2271 def exportLiteral(self, outfile, level, name_='SiconosModel'): 2272 level += 1 2273 already_processed = set() 2274 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2275 if self.hasContent_(): 2276 self.exportLiteralChildren(outfile, level, name_) 2277 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2278 pass 2279 def exportLiteralChildren(self, outfile, level, name_): 2280 if self.Title is not None: 2281 showIndent(outfile, level) 2282 outfile.write('Title=%s,\n' % quote_python(self.Title).encode(ExternalEncoding)) 2283 if self.Author is not None: 2284 showIndent(outfile, level) 2285 outfile.write('Author=%s,\n' % quote_python(self.Author).encode(ExternalEncoding)) 2286 if self.Description is not None: 2287 showIndent(outfile, level) 2288 outfile.write('Description=%s,\n' % quote_python(self.Description).encode(ExternalEncoding)) 2289 if self.Date is not None: 2290 showIndent(outfile, level) 2291 outfile.write('Date=%s,\n' % quote_python(self.Date).encode(ExternalEncoding)) 2292 if self.SchemaXML is not None: 2293 showIndent(outfile, level) 2294 outfile.write('SchemaXML=%s,\n' % quote_python(self.SchemaXML).encode(ExternalEncoding)) 2295 if self.Time is not None: 2296 showIndent(outfile, level) 2297 outfile.write('Time=model_.ModelTime(\n') 2298 self.Time.exportLiteral(outfile, level, name_='Time') 2299 showIndent(outfile, level) 2300 outfile.write('),\n') 2301 if self.NSDS is not None: 2302 showIndent(outfile, level) 2303 outfile.write('NSDS=model_.NSDSType(\n') 2304 self.NSDS.exportLiteral(outfile, level, name_='NSDS') 2305 showIndent(outfile, level) 2306 outfile.write('),\n') 2307 if self.Simulation is not None: 2308 showIndent(outfile, level) 2309 outfile.write('Simulation=model_.SimulationType(\n') 2310 self.Simulation.exportLiteral(outfile, level, name_='Simulation') 2311 showIndent(outfile, level) 2312 outfile.write('),\n') 2313 def build(self, node): 2314 already_processed = set() 2315 self.buildAttributes(node, node.attrib, already_processed) 2316 for child in node: 2317 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2318 self.buildChildren(child, node, nodeName_) 2319 return self 2320 def buildAttributes(self, node, attrs, already_processed): 2321 pass 2322 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2323 if nodeName_ == 'Title': 2324 Title_ = child_.text 2325 Title_ = self.gds_validate_string(Title_, node, 'Title') 2326 self.Title = Title_ 2327 elif nodeName_ == 'Author': 2328 Author_ = child_.text 2329 Author_ = self.gds_validate_string(Author_, node, 'Author') 2330 self.Author = Author_ 2331 elif nodeName_ == 'Description': 2332 Description_ = child_.text 2333 Description_ = self.gds_validate_string(Description_, node, 'Description') 2334 self.Description = Description_ 2335 elif nodeName_ == 'Date': 2336 Date_ = child_.text 2337 Date_ = self.gds_validate_string(Date_, node, 'Date') 2338 self.Date = Date_ 2339 elif nodeName_ == 'SchemaXML': 2340 SchemaXML_ = child_.text 2341 SchemaXML_ = self.gds_validate_string(SchemaXML_, node, 'SchemaXML') 2342 self.SchemaXML = SchemaXML_ 2343 elif nodeName_ == 'Time': 2344 obj_ = ModelTime.factory() 2345 obj_.build(child_) 2346 self.Time = obj_ 2347 elif nodeName_ == 'NSDS': 2348 obj_ = NSDSType.factory() 2349 obj_.build(child_) 2350 self.NSDS = obj_ 2351 elif nodeName_ == 'Simulation': 2352 obj_ = SimulationType.factory() 2353 obj_.build(child_) 2354 self.Simulation = obj_ 2355# end class SiconosModel 2356 2357 2358class LinearType(GeneratedsSuper): 2359 subclass = None 2360 superclass = None 2361 def __init__(self, Omega=None, Omega0=None, OmegaT=None): 2362 self.Omega = Omega 2363 self.Omega0 = Omega0 2364 self.OmegaT = OmegaT 2365 def factory(*args_, **kwargs_): 2366 if LinearType.subclass: 2367 return LinearType.subclass(*args_, **kwargs_) 2368 else: 2369 return LinearType(*args_, **kwargs_) 2370 factory = staticmethod(factory) 2371 def get_Omega(self): return self.Omega 2372 def set_Omega(self, Omega): self.Omega = Omega 2373 def get_Omega0(self): return self.Omega0 2374 def set_Omega0(self, Omega0): self.Omega0 = Omega0 2375 def get_OmegaT(self): return self.OmegaT 2376 def set_OmegaT(self, OmegaT): self.OmegaT = OmegaT 2377 def hasContent_(self): 2378 if ( 2379 self.Omega is not None or 2380 self.Omega0 is not None or 2381 self.OmegaT is not None 2382 ): 2383 return True 2384 else: 2385 return False 2386 def export(self, outfile, level, namespace_='', name_='LinearType', namespacedef_='', pretty_print=True): 2387 if pretty_print: 2388 eol_ = '\n' 2389 else: 2390 eol_ = '' 2391 showIndent(outfile, level, pretty_print) 2392 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2393 already_processed = set() 2394 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LinearType') 2395 if self.hasContent_(): 2396 outfile.write('>%s' % (eol_, )) 2397 self.exportChildren(outfile, level + 1, namespace_='', name_='LinearType', pretty_print=pretty_print) 2398 showIndent(outfile, level, pretty_print) 2399 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2400 else: 2401 outfile.write('/>%s' % (eol_, )) 2402 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LinearType'): 2403 pass 2404 def exportChildren(self, outfile, level, namespace_='', name_='LinearType', fromsubclass_=False, pretty_print=True): 2405 if pretty_print: 2406 eol_ = '\n' 2407 else: 2408 eol_ = '' 2409 if self.Omega is not None: 2410 self.Omega.export(outfile, level, namespace_, name_='Omega', pretty_print=pretty_print) 2411 if self.Omega0 is not None: 2412 self.Omega0.export(outfile, level, namespace_, name_='Omega0', pretty_print=pretty_print) 2413 if self.OmegaT is not None: 2414 self.OmegaT.export(outfile, level, namespace_, name_='OmegaT', pretty_print=pretty_print) 2415 def exportLiteral(self, outfile, level, name_='LinearType'): 2416 level += 1 2417 already_processed = set() 2418 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2419 if self.hasContent_(): 2420 self.exportLiteralChildren(outfile, level, name_) 2421 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2422 pass 2423 def exportLiteralChildren(self, outfile, level, name_): 2424 if self.Omega is not None: 2425 showIndent(outfile, level) 2426 outfile.write('Omega=model_.vector(\n') 2427 self.Omega.exportLiteral(outfile, level, name_='Omega') 2428 showIndent(outfile, level) 2429 outfile.write('),\n') 2430 if self.Omega0 is not None: 2431 showIndent(outfile, level) 2432 outfile.write('Omega0=model_.matrix(\n') 2433 self.Omega0.exportLiteral(outfile, level, name_='Omega0') 2434 showIndent(outfile, level) 2435 outfile.write('),\n') 2436 if self.OmegaT is not None: 2437 showIndent(outfile, level) 2438 outfile.write('OmegaT=model_.matrix(\n') 2439 self.OmegaT.exportLiteral(outfile, level, name_='OmegaT') 2440 showIndent(outfile, level) 2441 outfile.write('),\n') 2442 def build(self, node): 2443 already_processed = set() 2444 self.buildAttributes(node, node.attrib, already_processed) 2445 for child in node: 2446 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2447 self.buildChildren(child, node, nodeName_) 2448 return self 2449 def buildAttributes(self, node, attrs, already_processed): 2450 pass 2451 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2452 if nodeName_ == 'Omega': 2453 obj_ = vector.factory() 2454 obj_.build(child_) 2455 self.Omega = obj_ 2456 elif nodeName_ == 'Omega0': 2457 obj_ = matrix.factory() 2458 obj_.build(child_) 2459 self.Omega0 = obj_ 2460 elif nodeName_ == 'OmegaT': 2461 obj_ = matrix.factory() 2462 obj_.build(child_) 2463 self.OmegaT = obj_ 2464# end class LinearType 2465 2466 2467class NLinearType(GeneratedsSuper): 2468 subclass = None 2469 superclass = None 2470 def __init__(self, empty1=None): 2471 self.empty1 = empty1 2472 def factory(*args_, **kwargs_): 2473 if NLinearType.subclass: 2474 return NLinearType.subclass(*args_, **kwargs_) 2475 else: 2476 return NLinearType(*args_, **kwargs_) 2477 factory = staticmethod(factory) 2478 def get_empty1(self): return self.empty1 2479 def set_empty1(self, empty1): self.empty1 = empty1 2480 def validate_positiveDouble(self, value): 2481 # Validate type positiveDouble, a restriction on xsd:double. 2482 pass 2483 def hasContent_(self): 2484 if ( 2485 self.empty1 is not None 2486 ): 2487 return True 2488 else: 2489 return False 2490 def export(self, outfile, level, namespace_='', name_='NLinearType', namespacedef_='', pretty_print=True): 2491 if pretty_print: 2492 eol_ = '\n' 2493 else: 2494 eol_ = '' 2495 showIndent(outfile, level, pretty_print) 2496 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2497 already_processed = set() 2498 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NLinearType') 2499 if self.hasContent_(): 2500 outfile.write('>%s' % (eol_, )) 2501 self.exportChildren(outfile, level + 1, namespace_='', name_='NLinearType', pretty_print=pretty_print) 2502 showIndent(outfile, level, pretty_print) 2503 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2504 else: 2505 outfile.write('/>%s' % (eol_, )) 2506 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NLinearType'): 2507 pass 2508 def exportChildren(self, outfile, level, namespace_='', name_='NLinearType', fromsubclass_=False, pretty_print=True): 2509 if pretty_print: 2510 eol_ = '\n' 2511 else: 2512 eol_ = '' 2513 if self.empty1 is not None: 2514 showIndent(outfile, level, pretty_print) 2515 outfile.write('<%sempty1>%s</%sempty1>%s' % (namespace_, self.gds_format_double(self.empty1, input_name='empty1'), namespace_, eol_)) 2516 def exportLiteral(self, outfile, level, name_='NLinearType'): 2517 level += 1 2518 already_processed = set() 2519 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2520 if self.hasContent_(): 2521 self.exportLiteralChildren(outfile, level, name_) 2522 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2523 pass 2524 def exportLiteralChildren(self, outfile, level, name_): 2525 if self.empty1 is not None: 2526 showIndent(outfile, level) 2527 outfile.write('empty1=%e,\n' % self.empty1) 2528 def build(self, node): 2529 already_processed = set() 2530 self.buildAttributes(node, node.attrib, already_processed) 2531 for child in node: 2532 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2533 self.buildChildren(child, node, nodeName_) 2534 return self 2535 def buildAttributes(self, node, attrs, already_processed): 2536 pass 2537 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2538 if nodeName_ == 'empty1': 2539 sval_ = child_.text 2540 try: 2541 fval_ = float(sval_) 2542 except (TypeError, ValueError) as exp: 2543 raise_parse_error(child_, 'requires float or double: %s' % exp) 2544 fval_ = self.gds_validate_float(fval_, node, 'empty1') 2545 self.empty1 = fval_ 2546 self.validate_positiveDouble(self.empty1) # validate type positiveDouble 2547# end class NLinearType 2548 2549 2550class PeriodicType(GeneratedsSuper): 2551 subclass = None 2552 superclass = None 2553 def __init__(self, empty2=None): 2554 self.empty2 = empty2 2555 def factory(*args_, **kwargs_): 2556 if PeriodicType.subclass: 2557 return PeriodicType.subclass(*args_, **kwargs_) 2558 else: 2559 return PeriodicType(*args_, **kwargs_) 2560 factory = staticmethod(factory) 2561 def get_empty2(self): return self.empty2 2562 def set_empty2(self, empty2): self.empty2 = empty2 2563 def validate_positiveDouble(self, value): 2564 # Validate type positiveDouble, a restriction on xsd:double. 2565 pass 2566 def hasContent_(self): 2567 if ( 2568 self.empty2 is not None 2569 ): 2570 return True 2571 else: 2572 return False 2573 def export(self, outfile, level, namespace_='', name_='PeriodicType', namespacedef_='', pretty_print=True): 2574 if pretty_print: 2575 eol_ = '\n' 2576 else: 2577 eol_ = '' 2578 showIndent(outfile, level, pretty_print) 2579 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2580 already_processed = set() 2581 self.exportAttributes(outfile, level, already_processed, namespace_, name_='PeriodicType') 2582 if self.hasContent_(): 2583 outfile.write('>%s' % (eol_, )) 2584 self.exportChildren(outfile, level + 1, namespace_='', name_='PeriodicType', pretty_print=pretty_print) 2585 showIndent(outfile, level, pretty_print) 2586 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2587 else: 2588 outfile.write('/>%s' % (eol_, )) 2589 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PeriodicType'): 2590 pass 2591 def exportChildren(self, outfile, level, namespace_='', name_='PeriodicType', fromsubclass_=False, pretty_print=True): 2592 if pretty_print: 2593 eol_ = '\n' 2594 else: 2595 eol_ = '' 2596 if self.empty2 is not None: 2597 showIndent(outfile, level, pretty_print) 2598 outfile.write('<%sempty2>%s</%sempty2>%s' % (namespace_, self.gds_format_double(self.empty2, input_name='empty2'), namespace_, eol_)) 2599 def exportLiteral(self, outfile, level, name_='PeriodicType'): 2600 level += 1 2601 already_processed = set() 2602 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2603 if self.hasContent_(): 2604 self.exportLiteralChildren(outfile, level, name_) 2605 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2606 pass 2607 def exportLiteralChildren(self, outfile, level, name_): 2608 if self.empty2 is not None: 2609 showIndent(outfile, level) 2610 outfile.write('empty2=%e,\n' % self.empty2) 2611 def build(self, node): 2612 already_processed = set() 2613 self.buildAttributes(node, node.attrib, already_processed) 2614 for child in node: 2615 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2616 self.buildChildren(child, node, nodeName_) 2617 return self 2618 def buildAttributes(self, node, attrs, already_processed): 2619 pass 2620 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2621 if nodeName_ == 'empty2': 2622 sval_ = child_.text 2623 try: 2624 fval_ = float(sval_) 2625 except (TypeError, ValueError) as exp: 2626 raise_parse_error(child_, 'requires float or double: %s' % exp) 2627 fval_ = self.gds_validate_float(fval_, node, 'empty2') 2628 self.empty2 = fval_ 2629 self.validate_positiveDouble(self.empty2) # validate type positiveDouble 2630# end class PeriodicType 2631 2632 2633class NSDSType(GeneratedsSuper): 2634 subclass = None 2635 superclass = None 2636 def __init__(self, bvp=None, DS_LMGC90=None, DS_Definition=None, Interaction_Definition=None): 2637 self.bvp = _cast(None, bvp) 2638 self.DS_LMGC90 = DS_LMGC90 2639 self.DS_Definition = DS_Definition 2640 self.Interaction_Definition = Interaction_Definition 2641 def factory(*args_, **kwargs_): 2642 if NSDSType.subclass: 2643 return NSDSType.subclass(*args_, **kwargs_) 2644 else: 2645 return NSDSType(*args_, **kwargs_) 2646 factory = staticmethod(factory) 2647 def get_DS_LMGC90(self): return self.DS_LMGC90 2648 def set_DS_LMGC90(self, DS_LMGC90): self.DS_LMGC90 = DS_LMGC90 2649 def get_DS_Definition(self): return self.DS_Definition 2650 def set_DS_Definition(self, DS_Definition): self.DS_Definition = DS_Definition 2651 def get_Interaction_Definition(self): return self.Interaction_Definition 2652 def set_Interaction_Definition(self, Interaction_Definition): self.Interaction_Definition = Interaction_Definition 2653 def get_bvp(self): return self.bvp 2654 def set_bvp(self, bvp): self.bvp = bvp 2655 def validate_boolean(self, value): 2656 # Validate type boolean, a restriction on xsd:boolean. 2657 pass 2658 def hasContent_(self): 2659 if ( 2660 self.DS_LMGC90 is not None or 2661 self.DS_Definition is not None or 2662 self.Interaction_Definition is not None 2663 ): 2664 return True 2665 else: 2666 return False 2667 def export(self, outfile, level, namespace_='', name_='NSDSType', namespacedef_='', pretty_print=True): 2668 if pretty_print: 2669 eol_ = '\n' 2670 else: 2671 eol_ = '' 2672 showIndent(outfile, level, pretty_print) 2673 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2674 already_processed = set() 2675 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NSDSType') 2676 if self.hasContent_(): 2677 outfile.write('>%s' % (eol_, )) 2678 self.exportChildren(outfile, level + 1, namespace_='', name_='NSDSType', pretty_print=pretty_print) 2679 showIndent(outfile, level, pretty_print) 2680 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2681 else: 2682 outfile.write('/>%s' % (eol_, )) 2683 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NSDSType'): 2684 if self.bvp is not None and 'bvp' not in already_processed: 2685 already_processed.add('bvp') 2686 outfile.write(' bvp=%s' % (quote_attrib(self.bvp), )) 2687 def exportChildren(self, outfile, level, namespace_='', name_='NSDSType', fromsubclass_=False, pretty_print=True): 2688 if pretty_print: 2689 eol_ = '\n' 2690 else: 2691 eol_ = '' 2692 if self.DS_LMGC90 is not None: 2693 self.DS_LMGC90.export(outfile, level, namespace_, name_='DS_LMGC90', pretty_print=pretty_print) 2694 if self.DS_Definition is not None: 2695 self.DS_Definition.export(outfile, level, namespace_, name_='DS_Definition', pretty_print=pretty_print) 2696 if self.Interaction_Definition is not None: 2697 self.Interaction_Definition.export(outfile, level, namespace_, name_='Interaction_Definition', pretty_print=pretty_print) 2698 def exportLiteral(self, outfile, level, name_='NSDSType'): 2699 level += 1 2700 already_processed = set() 2701 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2702 if self.hasContent_(): 2703 self.exportLiteralChildren(outfile, level, name_) 2704 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2705 if self.bvp is not None and 'bvp' not in already_processed: 2706 already_processed.add('bvp') 2707 showIndent(outfile, level) 2708 outfile.write('bvp=%s,\n' % (self.bvp,)) 2709 def exportLiteralChildren(self, outfile, level, name_): 2710 if self.DS_LMGC90 is not None: 2711 showIndent(outfile, level) 2712 outfile.write('DS_LMGC90=model_.DS_LMGC90Type(\n') 2713 self.DS_LMGC90.exportLiteral(outfile, level, name_='DS_LMGC90') 2714 showIndent(outfile, level) 2715 outfile.write('),\n') 2716 if self.DS_Definition is not None: 2717 showIndent(outfile, level) 2718 outfile.write('DS_Definition=model_.DS_DefinitionType(\n') 2719 self.DS_Definition.exportLiteral(outfile, level, name_='DS_Definition') 2720 showIndent(outfile, level) 2721 outfile.write('),\n') 2722 if self.Interaction_Definition is not None: 2723 showIndent(outfile, level) 2724 outfile.write('Interaction_Definition=model_.Interaction_DefinitionType(\n') 2725 self.Interaction_Definition.exportLiteral(outfile, level, name_='Interaction_Definition') 2726 showIndent(outfile, level) 2727 outfile.write('),\n') 2728 def build(self, node): 2729 already_processed = set() 2730 self.buildAttributes(node, node.attrib, already_processed) 2731 for child in node: 2732 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2733 self.buildChildren(child, node, nodeName_) 2734 return self 2735 def buildAttributes(self, node, attrs, already_processed): 2736 value = find_attr_value_('bvp', node) 2737 if value is not None and 'bvp' not in already_processed: 2738 already_processed.add('bvp') 2739 if value in ('true', '1'): 2740 self.bvp = True 2741 elif value in ('false', '0'): 2742 self.bvp = False 2743 else: 2744 raise_parse_error(node, 'Bad boolean attribute') 2745 self.validate_boolean(self.bvp) # validate type boolean 2746 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2747 if nodeName_ == 'DS_LMGC90': 2748 obj_ = DS_LMGC90Type.factory() 2749 obj_.build(child_) 2750 self.DS_LMGC90 = obj_ 2751 elif nodeName_ == 'DS_Definition': 2752 obj_ = DS_DefinitionType.factory() 2753 obj_.build(child_) 2754 self.DS_Definition = obj_ 2755 elif nodeName_ == 'Interaction_Definition': 2756 obj_ = Interaction_DefinitionType.factory() 2757 obj_.build(child_) 2758 self.Interaction_Definition = obj_ 2759# end class NSDSType 2760 2761 2762class DS_LMGC90Type(GeneratedsSuper): 2763 subclass = None 2764 superclass = None 2765 def __init__(self, empty=None): 2766 self.empty = empty 2767 def factory(*args_, **kwargs_): 2768 if DS_LMGC90Type.subclass: 2769 return DS_LMGC90Type.subclass(*args_, **kwargs_) 2770 else: 2771 return DS_LMGC90Type(*args_, **kwargs_) 2772 factory = staticmethod(factory) 2773 def get_empty(self): return self.empty 2774 def set_empty(self, empty): self.empty = empty 2775 def hasContent_(self): 2776 if ( 2777 self.empty is not None 2778 ): 2779 return True 2780 else: 2781 return False 2782 def export(self, outfile, level, namespace_='', name_='DS_LMGC90Type', namespacedef_='', pretty_print=True): 2783 if pretty_print: 2784 eol_ = '\n' 2785 else: 2786 eol_ = '' 2787 showIndent(outfile, level, pretty_print) 2788 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2789 already_processed = set() 2790 self.exportAttributes(outfile, level, already_processed, namespace_, name_='DS_LMGC90Type') 2791 if self.hasContent_(): 2792 outfile.write('>%s' % (eol_, )) 2793 self.exportChildren(outfile, level + 1, namespace_='', name_='DS_LMGC90Type', pretty_print=pretty_print) 2794 showIndent(outfile, level, pretty_print) 2795 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2796 else: 2797 outfile.write('/>%s' % (eol_, )) 2798 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DS_LMGC90Type'): 2799 pass 2800 def exportChildren(self, outfile, level, namespace_='', name_='DS_LMGC90Type', fromsubclass_=False, pretty_print=True): 2801 if pretty_print: 2802 eol_ = '\n' 2803 else: 2804 eol_ = '' 2805 if self.empty is not None: 2806 showIndent(outfile, level, pretty_print) 2807 outfile.write('<%sempty>%s</%sempty>%s' % (namespace_, self.gds_format_string(quote_xml(self.empty).encode(ExternalEncoding), input_name='empty'), namespace_, eol_)) 2808 def exportLiteral(self, outfile, level, name_='DS_LMGC90Type'): 2809 level += 1 2810 already_processed = set() 2811 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2812 if self.hasContent_(): 2813 self.exportLiteralChildren(outfile, level, name_) 2814 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2815 pass 2816 def exportLiteralChildren(self, outfile, level, name_): 2817 if self.empty is not None: 2818 showIndent(outfile, level) 2819 outfile.write('empty=%s,\n' % quote_python(self.empty).encode(ExternalEncoding)) 2820 def build(self, node): 2821 already_processed = set() 2822 self.buildAttributes(node, node.attrib, already_processed) 2823 for child in node: 2824 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 2825 self.buildChildren(child, node, nodeName_) 2826 return self 2827 def buildAttributes(self, node, attrs, already_processed): 2828 pass 2829 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 2830 if nodeName_ == 'empty': 2831 empty_ = child_.text 2832 empty_ = self.gds_validate_string(empty_, node, 'empty') 2833 self.empty = empty_ 2834# end class DS_LMGC90Type 2835 2836 2837class DS_DefinitionType(GeneratedsSuper): 2838 subclass = None 2839 superclass = None 2840 def __init__(self, FirstOrderNonLinearDS=None, FirstOrderLinearDS=None, FirstOrderLinearTIDS=None, LagrangianDS=None, LagrangianLinearTIDS=None): 2841 if FirstOrderNonLinearDS is None: 2842 self.FirstOrderNonLinearDS = [] 2843 else: 2844 self.FirstOrderNonLinearDS = FirstOrderNonLinearDS 2845 if FirstOrderLinearDS is None: 2846 self.FirstOrderLinearDS = [] 2847 else: 2848 self.FirstOrderLinearDS = FirstOrderLinearDS 2849 if FirstOrderLinearTIDS is None: 2850 self.FirstOrderLinearTIDS = [] 2851 else: 2852 self.FirstOrderLinearTIDS = FirstOrderLinearTIDS 2853 if LagrangianDS is None: 2854 self.LagrangianDS = [] 2855 else: 2856 self.LagrangianDS = LagrangianDS 2857 if LagrangianLinearTIDS is None: 2858 self.LagrangianLinearTIDS = [] 2859 else: 2860 self.LagrangianLinearTIDS = LagrangianLinearTIDS 2861 def factory(*args_, **kwargs_): 2862 if DS_DefinitionType.subclass: 2863 return DS_DefinitionType.subclass(*args_, **kwargs_) 2864 else: 2865 return DS_DefinitionType(*args_, **kwargs_) 2866 factory = staticmethod(factory) 2867 def get_FirstOrderNonLinearDS(self): return self.FirstOrderNonLinearDS 2868 def set_FirstOrderNonLinearDS(self, FirstOrderNonLinearDS): self.FirstOrderNonLinearDS = FirstOrderNonLinearDS 2869 def add_FirstOrderNonLinearDS(self, value): self.FirstOrderNonLinearDS.append(value) 2870 def insert_FirstOrderNonLinearDS(self, index, value): self.FirstOrderNonLinearDS[index] = value 2871 def get_FirstOrderLinearDS(self): return self.FirstOrderLinearDS 2872 def set_FirstOrderLinearDS(self, FirstOrderLinearDS): self.FirstOrderLinearDS = FirstOrderLinearDS 2873 def add_FirstOrderLinearDS(self, value): self.FirstOrderLinearDS.append(value) 2874 def insert_FirstOrderLinearDS(self, index, value): self.FirstOrderLinearDS[index] = value 2875 def get_FirstOrderLinearTIDS(self): return self.FirstOrderLinearTIDS 2876 def set_FirstOrderLinearTIDS(self, FirstOrderLinearTIDS): self.FirstOrderLinearTIDS = FirstOrderLinearTIDS 2877 def add_FirstOrderLinearTIDS(self, value): self.FirstOrderLinearTIDS.append(value) 2878 def insert_FirstOrderLinearTIDS(self, index, value): self.FirstOrderLinearTIDS[index] = value 2879 def get_LagrangianDS(self): return self.LagrangianDS 2880 def set_LagrangianDS(self, LagrangianDS): self.LagrangianDS = LagrangianDS 2881 def add_LagrangianDS(self, value): self.LagrangianDS.append(value) 2882 def insert_LagrangianDS(self, index, value): self.LagrangianDS[index] = value 2883 def get_LagrangianLinearTIDS(self): return self.LagrangianLinearTIDS 2884 def set_LagrangianLinearTIDS(self, LagrangianLinearTIDS): self.LagrangianLinearTIDS = LagrangianLinearTIDS 2885 def add_LagrangianLinearTIDS(self, value): self.LagrangianLinearTIDS.append(value) 2886 def insert_LagrangianLinearTIDS(self, index, value): self.LagrangianLinearTIDS[index] = value 2887 def hasContent_(self): 2888 if ( 2889 self.FirstOrderNonLinearDS or 2890 self.FirstOrderLinearDS or 2891 self.FirstOrderLinearTIDS or 2892 self.LagrangianDS or 2893 self.LagrangianLinearTIDS 2894 ): 2895 return True 2896 else: 2897 return False 2898 def export(self, outfile, level, namespace_='', name_='DS_DefinitionType', namespacedef_='', pretty_print=True): 2899 if pretty_print: 2900 eol_ = '\n' 2901 else: 2902 eol_ = '' 2903 showIndent(outfile, level, pretty_print) 2904 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 2905 already_processed = set() 2906 self.exportAttributes(outfile, level, already_processed, namespace_, name_='DS_DefinitionType') 2907 if self.hasContent_(): 2908 outfile.write('>%s' % (eol_, )) 2909 self.exportChildren(outfile, level + 1, namespace_='', name_='DS_DefinitionType', pretty_print=pretty_print) 2910 showIndent(outfile, level, pretty_print) 2911 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 2912 else: 2913 outfile.write('/>%s' % (eol_, )) 2914 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DS_DefinitionType'): 2915 pass 2916 def exportChildren(self, outfile, level, namespace_='', name_='DS_DefinitionType', fromsubclass_=False, pretty_print=True): 2917 if pretty_print: 2918 eol_ = '\n' 2919 else: 2920 eol_ = '' 2921 for FirstOrderNonLinearDS_ in self.FirstOrderNonLinearDS: 2922 FirstOrderNonLinearDS_.export(outfile, level, namespace_, name_='FirstOrderNonLinearDS', pretty_print=pretty_print) 2923 for FirstOrderLinearDS_ in self.FirstOrderLinearDS: 2924 FirstOrderLinearDS_.export(outfile, level, namespace_, name_='FirstOrderLinearDS', pretty_print=pretty_print) 2925 for FirstOrderLinearTIDS_ in self.FirstOrderLinearTIDS: 2926 FirstOrderLinearTIDS_.export(outfile, level, namespace_, name_='FirstOrderLinearTIDS', pretty_print=pretty_print) 2927 for LagrangianDS_ in self.LagrangianDS: 2928 LagrangianDS_.export(outfile, level, namespace_, name_='LagrangianDS', pretty_print=pretty_print) 2929 for LagrangianLinearTIDS_ in self.LagrangianLinearTIDS: 2930 LagrangianLinearTIDS_.export(outfile, level, namespace_, name_='LagrangianLinearTIDS', pretty_print=pretty_print) 2931 def exportLiteral(self, outfile, level, name_='DS_DefinitionType'): 2932 level += 1 2933 already_processed = set() 2934 self.exportLiteralAttributes(outfile, level, already_processed, name_) 2935 if self.hasContent_(): 2936 self.exportLiteralChildren(outfile, level, name_) 2937 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 2938 pass 2939 def exportLiteralChildren(self, outfile, level, name_): 2940 showIndent(outfile, level) 2941 outfile.write('FirstOrderNonLinearDS=[\n') 2942 level += 1 2943 for FirstOrderNonLinearDS_ in self.FirstOrderNonLinearDS: 2944 showIndent(outfile, level) 2945 outfile.write('model_.FirstOrderNonLinearDSType(\n') 2946 FirstOrderNonLinearDS_.exportLiteral(outfile, level, name_='FirstOrderNonLinearDSType') 2947 showIndent(outfile, level) 2948 outfile.write('),\n') 2949 level -= 1 2950 showIndent(outfile, level) 2951 outfile.write('],\n') 2952 showIndent(outfile, level) 2953 outfile.write('FirstOrderLinearDS=[\n') 2954 level += 1 2955 for FirstOrderLinearDS_ in self.FirstOrderLinearDS: 2956 showIndent(outfile, level) 2957 outfile.write('model_.FirstOrderLinearDSType(\n') 2958 FirstOrderLinearDS_.exportLiteral(outfile, level, name_='FirstOrderLinearDSType') 2959 showIndent(outfile, level) 2960 outfile.write('),\n') 2961 level -= 1 2962 showIndent(outfile, level) 2963 outfile.write('],\n') 2964 showIndent(outfile, level) 2965 outfile.write('FirstOrderLinearTIDS=[\n') 2966 level += 1 2967 for FirstOrderLinearTIDS_ in self.FirstOrderLinearTIDS: 2968 showIndent(outfile, level) 2969 outfile.write('model_.FirstOrderLinearTIDSType(\n') 2970 FirstOrderLinearTIDS_.exportLiteral(outfile, level, name_='FirstOrderLinearTIDSType') 2971 showIndent(outfile, level) 2972 outfile.write('),\n') 2973 level -= 1 2974 showIndent(outfile, level) 2975 outfile.write('],\n') 2976 showIndent(outfile, level) 2977 outfile.write('LagrangianDS=[\n') 2978 level += 1 2979 for LagrangianDS_ in self.LagrangianDS: 2980 showIndent(outfile, level) 2981 outfile.write('model_.LagrangianDSType(\n') 2982 LagrangianDS_.exportLiteral(outfile, level, name_='LagrangianDSType') 2983 showIndent(outfile, level) 2984 outfile.write('),\n') 2985 level -= 1 2986 showIndent(outfile, level) 2987 outfile.write('],\n') 2988 showIndent(outfile, level) 2989 outfile.write('LagrangianLinearTIDS=[\n') 2990 level += 1 2991 for LagrangianLinearTIDS_ in self.LagrangianLinearTIDS: 2992 showIndent(outfile, level) 2993 outfile.write('model_.LagrangianLinearTIDSType(\n') 2994 LagrangianLinearTIDS_.exportLiteral(outfile, level, name_='LagrangianLinearTIDSType') 2995 showIndent(outfile, level) 2996 outfile.write('),\n') 2997 level -= 1 2998 showIndent(outfile, level) 2999 outfile.write('],\n') 3000 def build(self, node): 3001 already_processed = set() 3002 self.buildAttributes(node, node.attrib, already_processed) 3003 for child in node: 3004 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3005 self.buildChildren(child, node, nodeName_) 3006 return self 3007 def buildAttributes(self, node, attrs, already_processed): 3008 pass 3009 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3010 if nodeName_ == 'FirstOrderNonLinearDS': 3011 obj_ = FirstOrderNonLinearDSType.factory() 3012 obj_.build(child_) 3013 self.FirstOrderNonLinearDS.append(obj_) 3014 elif nodeName_ == 'FirstOrderLinearDS': 3015 obj_ = FirstOrderLinearDSType.factory() 3016 obj_.build(child_) 3017 self.FirstOrderLinearDS.append(obj_) 3018 elif nodeName_ == 'FirstOrderLinearTIDS': 3019 obj_ = FirstOrderLinearTIDSType.factory() 3020 obj_.build(child_) 3021 self.FirstOrderLinearTIDS.append(obj_) 3022 elif nodeName_ == 'LagrangianDS': 3023 obj_ = LagrangianDSType.factory() 3024 obj_.build(child_) 3025 self.LagrangianDS.append(obj_) 3026 elif nodeName_ == 'LagrangianLinearTIDS': 3027 obj_ = LagrangianLinearTIDSType.factory() 3028 obj_.build(child_) 3029 self.LagrangianLinearTIDS.append(obj_) 3030# end class DS_DefinitionType 3031 3032 3033class FirstOrderNonLinearDSType(GeneratedsSuper): 3034 subclass = None 3035 superclass = None 3036 def __init__(self, Name=None, x0=None, M=None, f=None, Jacobianfx=None): 3037 self.Name = _cast(None, Name) 3038 self.x0 = x0 3039 self.M = M 3040 self.f = f 3041 self.Jacobianfx = Jacobianfx 3042 def factory(*args_, **kwargs_): 3043 if FirstOrderNonLinearDSType.subclass: 3044 return FirstOrderNonLinearDSType.subclass(*args_, **kwargs_) 3045 else: 3046 return FirstOrderNonLinearDSType(*args_, **kwargs_) 3047 factory = staticmethod(factory) 3048 def get_x0(self): return self.x0 3049 def set_x0(self, x0): self.x0 = x0 3050 def get_M(self): return self.M 3051 def set_M(self, M): self.M = M 3052 def get_f(self): return self.f 3053 def set_f(self, f): self.f = f 3054 def get_Jacobianfx(self): return self.Jacobianfx 3055 def set_Jacobianfx(self, Jacobianfx): self.Jacobianfx = Jacobianfx 3056 def get_Name(self): return self.Name 3057 def set_Name(self, Name): self.Name = Name 3058 def hasContent_(self): 3059 if ( 3060 self.x0 is not None or 3061 self.M is not None or 3062 self.f is not None or 3063 self.Jacobianfx is not None 3064 ): 3065 return True 3066 else: 3067 return False 3068 def export(self, outfile, level, namespace_='', name_='FirstOrderNonLinearDSType', namespacedef_='', pretty_print=True): 3069 if pretty_print: 3070 eol_ = '\n' 3071 else: 3072 eol_ = '' 3073 showIndent(outfile, level, pretty_print) 3074 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3075 already_processed = set() 3076 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderNonLinearDSType') 3077 if self.hasContent_(): 3078 outfile.write('>%s' % (eol_, )) 3079 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderNonLinearDSType', pretty_print=pretty_print) 3080 showIndent(outfile, level, pretty_print) 3081 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3082 else: 3083 outfile.write('/>%s' % (eol_, )) 3084 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderNonLinearDSType'): 3085 if self.Name is not None and 'Name' not in already_processed: 3086 already_processed.add('Name') 3087 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3088 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderNonLinearDSType', fromsubclass_=False, pretty_print=True): 3089 if pretty_print: 3090 eol_ = '\n' 3091 else: 3092 eol_ = '' 3093 if self.x0 is not None: 3094 self.x0.export(outfile, level, namespace_, name_='x0', pretty_print=pretty_print) 3095 if self.M is not None: 3096 self.M.export(outfile, level, namespace_, name_='M', pretty_print=pretty_print) 3097 if self.f is not None: 3098 self.f.export(outfile, level, namespace_, name_='f', pretty_print=pretty_print) 3099 if self.Jacobianfx is not None: 3100 self.Jacobianfx.export(outfile, level, namespace_, name_='Jacobianfx', pretty_print=pretty_print) 3101 def exportLiteral(self, outfile, level, name_='FirstOrderNonLinearDSType'): 3102 level += 1 3103 already_processed = set() 3104 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3105 if self.hasContent_(): 3106 self.exportLiteralChildren(outfile, level, name_) 3107 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3108 if self.Name is not None and 'Name' not in already_processed: 3109 already_processed.add('Name') 3110 showIndent(outfile, level) 3111 outfile.write('Name="%s",\n' % (self.Name,)) 3112 def exportLiteralChildren(self, outfile, level, name_): 3113 if self.x0 is not None: 3114 showIndent(outfile, level) 3115 outfile.write('x0=model_.vector(\n') 3116 self.x0.exportLiteral(outfile, level, name_='x0') 3117 showIndent(outfile, level) 3118 outfile.write('),\n') 3119 if self.M is not None: 3120 showIndent(outfile, level) 3121 outfile.write('M=model_.matrix(\n') 3122 self.M.exportLiteral(outfile, level, name_='M') 3123 showIndent(outfile, level) 3124 outfile.write('),\n') 3125 if self.f is not None: 3126 showIndent(outfile, level) 3127 outfile.write('f=model_.vector(\n') 3128 self.f.exportLiteral(outfile, level, name_='f') 3129 showIndent(outfile, level) 3130 outfile.write('),\n') 3131 if self.Jacobianfx is not None: 3132 showIndent(outfile, level) 3133 outfile.write('Jacobianfx=model_.matrix(\n') 3134 self.Jacobianfx.exportLiteral(outfile, level, name_='Jacobianfx') 3135 showIndent(outfile, level) 3136 outfile.write('),\n') 3137 def build(self, node): 3138 already_processed = set() 3139 self.buildAttributes(node, node.attrib, already_processed) 3140 for child in node: 3141 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3142 self.buildChildren(child, node, nodeName_) 3143 return self 3144 def buildAttributes(self, node, attrs, already_processed): 3145 value = find_attr_value_('Name', node) 3146 if value is not None and 'Name' not in already_processed: 3147 already_processed.add('Name') 3148 self.Name = value 3149 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3150 if nodeName_ == 'x0': 3151 obj_ = vector.factory() 3152 obj_.build(child_) 3153 self.x0 = obj_ 3154 elif nodeName_ == 'M': 3155 obj_ = matrix.factory() 3156 obj_.build(child_) 3157 self.M = obj_ 3158 elif nodeName_ == 'f': 3159 obj_ = vector.factory() 3160 obj_.build(child_) 3161 self.f = obj_ 3162 elif nodeName_ == 'Jacobianfx': 3163 obj_ = matrix.factory() 3164 obj_.build(child_) 3165 self.Jacobianfx = obj_ 3166# end class FirstOrderNonLinearDSType 3167 3168 3169class FirstOrderLinearDSType(GeneratedsSuper): 3170 subclass = None 3171 superclass = None 3172 def __init__(self, Name=None, x0=None, A=None, b=None, M=None): 3173 self.Name = _cast(None, Name) 3174 self.x0 = x0 3175 self.A = A 3176 self.b = b 3177 self.M = M 3178 def factory(*args_, **kwargs_): 3179 if FirstOrderLinearDSType.subclass: 3180 return FirstOrderLinearDSType.subclass(*args_, **kwargs_) 3181 else: 3182 return FirstOrderLinearDSType(*args_, **kwargs_) 3183 factory = staticmethod(factory) 3184 def get_x0(self): return self.x0 3185 def set_x0(self, x0): self.x0 = x0 3186 def get_A(self): return self.A 3187 def set_A(self, A): self.A = A 3188 def get_b(self): return self.b 3189 def set_b(self, b): self.b = b 3190 def get_M(self): return self.M 3191 def set_M(self, M): self.M = M 3192 def get_Name(self): return self.Name 3193 def set_Name(self, Name): self.Name = Name 3194 def hasContent_(self): 3195 if ( 3196 self.x0 is not None or 3197 self.A is not None or 3198 self.b is not None or 3199 self.M is not None 3200 ): 3201 return True 3202 else: 3203 return False 3204 def export(self, outfile, level, namespace_='', name_='FirstOrderLinearDSType', namespacedef_='', pretty_print=True): 3205 if pretty_print: 3206 eol_ = '\n' 3207 else: 3208 eol_ = '' 3209 showIndent(outfile, level, pretty_print) 3210 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3211 already_processed = set() 3212 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderLinearDSType') 3213 if self.hasContent_(): 3214 outfile.write('>%s' % (eol_, )) 3215 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderLinearDSType', pretty_print=pretty_print) 3216 showIndent(outfile, level, pretty_print) 3217 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3218 else: 3219 outfile.write('/>%s' % (eol_, )) 3220 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderLinearDSType'): 3221 if self.Name is not None and 'Name' not in already_processed: 3222 already_processed.add('Name') 3223 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3224 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderLinearDSType', fromsubclass_=False, pretty_print=True): 3225 if pretty_print: 3226 eol_ = '\n' 3227 else: 3228 eol_ = '' 3229 if self.x0 is not None: 3230 self.x0.export(outfile, level, namespace_, name_='x0', pretty_print=pretty_print) 3231 if self.A is not None: 3232 self.A.export(outfile, level, namespace_, name_='A', pretty_print=pretty_print) 3233 if self.b is not None: 3234 self.b.export(outfile, level, namespace_, name_='b', pretty_print=pretty_print) 3235 if self.M is not None: 3236 self.M.export(outfile, level, namespace_, name_='M', pretty_print=pretty_print) 3237 def exportLiteral(self, outfile, level, name_='FirstOrderLinearDSType'): 3238 level += 1 3239 already_processed = set() 3240 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3241 if self.hasContent_(): 3242 self.exportLiteralChildren(outfile, level, name_) 3243 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3244 if self.Name is not None and 'Name' not in already_processed: 3245 already_processed.add('Name') 3246 showIndent(outfile, level) 3247 outfile.write('Name="%s",\n' % (self.Name,)) 3248 def exportLiteralChildren(self, outfile, level, name_): 3249 if self.x0 is not None: 3250 showIndent(outfile, level) 3251 outfile.write('x0=model_.vector(\n') 3252 self.x0.exportLiteral(outfile, level, name_='x0') 3253 showIndent(outfile, level) 3254 outfile.write('),\n') 3255 if self.A is not None: 3256 showIndent(outfile, level) 3257 outfile.write('A=model_.matrix(\n') 3258 self.A.exportLiteral(outfile, level, name_='A') 3259 showIndent(outfile, level) 3260 outfile.write('),\n') 3261 if self.b is not None: 3262 showIndent(outfile, level) 3263 outfile.write('b=model_.vector(\n') 3264 self.b.exportLiteral(outfile, level, name_='b') 3265 showIndent(outfile, level) 3266 outfile.write('),\n') 3267 if self.M is not None: 3268 showIndent(outfile, level) 3269 outfile.write('M=model_.matrix(\n') 3270 self.M.exportLiteral(outfile, level, name_='M') 3271 showIndent(outfile, level) 3272 outfile.write('),\n') 3273 def build(self, node): 3274 already_processed = set() 3275 self.buildAttributes(node, node.attrib, already_processed) 3276 for child in node: 3277 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3278 self.buildChildren(child, node, nodeName_) 3279 return self 3280 def buildAttributes(self, node, attrs, already_processed): 3281 value = find_attr_value_('Name', node) 3282 if value is not None and 'Name' not in already_processed: 3283 already_processed.add('Name') 3284 self.Name = value 3285 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3286 if nodeName_ == 'x0': 3287 obj_ = vector.factory() 3288 obj_.build(child_) 3289 self.x0 = obj_ 3290 elif nodeName_ == 'A': 3291 obj_ = matrix.factory() 3292 obj_.build(child_) 3293 self.A = obj_ 3294 elif nodeName_ == 'b': 3295 obj_ = vector.factory() 3296 obj_.build(child_) 3297 self.b = obj_ 3298 elif nodeName_ == 'M': 3299 obj_ = matrix.factory() 3300 obj_.build(child_) 3301 self.M = obj_ 3302# end class FirstOrderLinearDSType 3303 3304 3305class FirstOrderLinearTIDSType(GeneratedsSuper): 3306 subclass = None 3307 superclass = None 3308 def __init__(self, Name=None, x0=None, A=None, M=None, b=None): 3309 self.Name = _cast(None, Name) 3310 self.x0 = x0 3311 self.A = A 3312 self.M = M 3313 self.b = b 3314 def factory(*args_, **kwargs_): 3315 if FirstOrderLinearTIDSType.subclass: 3316 return FirstOrderLinearTIDSType.subclass(*args_, **kwargs_) 3317 else: 3318 return FirstOrderLinearTIDSType(*args_, **kwargs_) 3319 factory = staticmethod(factory) 3320 def get_x0(self): return self.x0 3321 def set_x0(self, x0): self.x0 = x0 3322 def get_A(self): return self.A 3323 def set_A(self, A): self.A = A 3324 def get_M(self): return self.M 3325 def set_M(self, M): self.M = M 3326 def get_b(self): return self.b 3327 def set_b(self, b): self.b = b 3328 def get_Name(self): return self.Name 3329 def set_Name(self, Name): self.Name = Name 3330 def hasContent_(self): 3331 if ( 3332 self.x0 is not None or 3333 self.A is not None or 3334 self.M is not None or 3335 self.b is not None 3336 ): 3337 return True 3338 else: 3339 return False 3340 def export(self, outfile, level, namespace_='', name_='FirstOrderLinearTIDSType', namespacedef_='', pretty_print=True): 3341 if pretty_print: 3342 eol_ = '\n' 3343 else: 3344 eol_ = '' 3345 showIndent(outfile, level, pretty_print) 3346 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3347 already_processed = set() 3348 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderLinearTIDSType') 3349 if self.hasContent_(): 3350 outfile.write('>%s' % (eol_, )) 3351 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderLinearTIDSType', pretty_print=pretty_print) 3352 showIndent(outfile, level, pretty_print) 3353 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3354 else: 3355 outfile.write('/>%s' % (eol_, )) 3356 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderLinearTIDSType'): 3357 if self.Name is not None and 'Name' not in already_processed: 3358 already_processed.add('Name') 3359 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3360 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderLinearTIDSType', fromsubclass_=False, pretty_print=True): 3361 if pretty_print: 3362 eol_ = '\n' 3363 else: 3364 eol_ = '' 3365 if self.x0 is not None: 3366 self.x0.export(outfile, level, namespace_, name_='x0', pretty_print=pretty_print) 3367 if self.A is not None: 3368 self.A.export(outfile, level, namespace_, name_='A', pretty_print=pretty_print) 3369 if self.M is not None: 3370 self.M.export(outfile, level, namespace_, name_='M', pretty_print=pretty_print) 3371 if self.b is not None: 3372 self.b.export(outfile, level, namespace_, name_='b', pretty_print=pretty_print) 3373 def exportLiteral(self, outfile, level, name_='FirstOrderLinearTIDSType'): 3374 level += 1 3375 already_processed = set() 3376 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3377 if self.hasContent_(): 3378 self.exportLiteralChildren(outfile, level, name_) 3379 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3380 if self.Name is not None and 'Name' not in already_processed: 3381 already_processed.add('Name') 3382 showIndent(outfile, level) 3383 outfile.write('Name="%s",\n' % (self.Name,)) 3384 def exportLiteralChildren(self, outfile, level, name_): 3385 if self.x0 is not None: 3386 showIndent(outfile, level) 3387 outfile.write('x0=model_.vector(\n') 3388 self.x0.exportLiteral(outfile, level, name_='x0') 3389 showIndent(outfile, level) 3390 outfile.write('),\n') 3391 if self.A is not None: 3392 showIndent(outfile, level) 3393 outfile.write('A=model_.matrix(\n') 3394 self.A.exportLiteral(outfile, level, name_='A') 3395 showIndent(outfile, level) 3396 outfile.write('),\n') 3397 if self.M is not None: 3398 showIndent(outfile, level) 3399 outfile.write('M=model_.matrix(\n') 3400 self.M.exportLiteral(outfile, level, name_='M') 3401 showIndent(outfile, level) 3402 outfile.write('),\n') 3403 if self.b is not None: 3404 showIndent(outfile, level) 3405 outfile.write('b=model_.vector(\n') 3406 self.b.exportLiteral(outfile, level, name_='b') 3407 showIndent(outfile, level) 3408 outfile.write('),\n') 3409 def build(self, node): 3410 already_processed = set() 3411 self.buildAttributes(node, node.attrib, already_processed) 3412 for child in node: 3413 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3414 self.buildChildren(child, node, nodeName_) 3415 return self 3416 def buildAttributes(self, node, attrs, already_processed): 3417 value = find_attr_value_('Name', node) 3418 if value is not None and 'Name' not in already_processed: 3419 already_processed.add('Name') 3420 self.Name = value 3421 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3422 if nodeName_ == 'x0': 3423 obj_ = vector.factory() 3424 obj_.build(child_) 3425 self.x0 = obj_ 3426 elif nodeName_ == 'A': 3427 obj_ = matrix.factory() 3428 obj_.build(child_) 3429 self.A = obj_ 3430 elif nodeName_ == 'M': 3431 obj_ = matrix.factory() 3432 obj_.build(child_) 3433 self.M = obj_ 3434 elif nodeName_ == 'b': 3435 obj_ = vector.factory() 3436 obj_.build(child_) 3437 self.b = obj_ 3438# end class FirstOrderLinearTIDSType 3439 3440 3441class LagrangianDSType(GeneratedsSuper): 3442 subclass = None 3443 superclass = None 3444 def __init__(self, Name=None, q0=None, Velocity0=None, Mass=None, FInt=None, FExt=None, FGyr=None, JacobianQFInt=None, JacobianVelocityFInt=None, JacobianQFGyr=None, JacobianVelocityFGyr=None): 3445 self.Name = _cast(None, Name) 3446 self.q0 = q0 3447 self.Velocity0 = Velocity0 3448 self.Mass = Mass 3449 self.FInt = FInt 3450 self.FExt = FExt 3451 self.FGyr = FGyr 3452 self.JacobianQFInt = JacobianQFInt 3453 self.JacobianVelocityFInt = JacobianVelocityFInt 3454 self.JacobianQFGyr = JacobianQFGyr 3455 self.JacobianVelocityFGyr = JacobianVelocityFGyr 3456 def factory(*args_, **kwargs_): 3457 if LagrangianDSType.subclass: 3458 return LagrangianDSType.subclass(*args_, **kwargs_) 3459 else: 3460 return LagrangianDSType(*args_, **kwargs_) 3461 factory = staticmethod(factory) 3462 def get_q0(self): return self.q0 3463 def set_q0(self, q0): self.q0 = q0 3464 def get_Velocity0(self): return self.Velocity0 3465 def set_Velocity0(self, Velocity0): self.Velocity0 = Velocity0 3466 def get_Mass(self): return self.Mass 3467 def set_Mass(self, Mass): self.Mass = Mass 3468 def get_FInt(self): return self.FInt 3469 def set_FInt(self, FInt): self.FInt = FInt 3470 def get_FExt(self): return self.FExt 3471 def set_FExt(self, FExt): self.FExt = FExt 3472 def get_FGyr(self): return self.FGyr 3473 def set_FGyr(self, FGyr): self.FGyr = FGyr 3474 def get_JacobianQFInt(self): return self.JacobianQFInt 3475 def set_JacobianQFInt(self, JacobianQFInt): self.JacobianQFInt = JacobianQFInt 3476 def get_JacobianVelocityFInt(self): return self.JacobianVelocityFInt 3477 def set_JacobianVelocityFInt(self, JacobianVelocityFInt): self.JacobianVelocityFInt = JacobianVelocityFInt 3478 def get_JacobianQFGyr(self): return self.JacobianQFGyr 3479 def set_JacobianQFGyr(self, JacobianQFGyr): self.JacobianQFGyr = JacobianQFGyr 3480 def get_JacobianVelocityFGyr(self): return self.JacobianVelocityFGyr 3481 def set_JacobianVelocityFGyr(self, JacobianVelocityFGyr): self.JacobianVelocityFGyr = JacobianVelocityFGyr 3482 def get_Name(self): return self.Name 3483 def set_Name(self, Name): self.Name = Name 3484 def hasContent_(self): 3485 if ( 3486 self.q0 is not None or 3487 self.Velocity0 is not None or 3488 self.Mass is not None or 3489 self.FInt is not None or 3490 self.FExt is not None or 3491 self.FGyr is not None or 3492 self.JacobianQFInt is not None or 3493 self.JacobianVelocityFInt is not None or 3494 self.JacobianQFGyr is not None or 3495 self.JacobianVelocityFGyr is not None 3496 ): 3497 return True 3498 else: 3499 return False 3500 def export(self, outfile, level, namespace_='', name_='LagrangianDSType', namespacedef_='', pretty_print=True): 3501 if pretty_print: 3502 eol_ = '\n' 3503 else: 3504 eol_ = '' 3505 showIndent(outfile, level, pretty_print) 3506 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3507 already_processed = set() 3508 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianDSType') 3509 if self.hasContent_(): 3510 outfile.write('>%s' % (eol_, )) 3511 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianDSType', pretty_print=pretty_print) 3512 showIndent(outfile, level, pretty_print) 3513 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3514 else: 3515 outfile.write('/>%s' % (eol_, )) 3516 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianDSType'): 3517 if self.Name is not None and 'Name' not in already_processed: 3518 already_processed.add('Name') 3519 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3520 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianDSType', fromsubclass_=False, pretty_print=True): 3521 if pretty_print: 3522 eol_ = '\n' 3523 else: 3524 eol_ = '' 3525 if self.q0 is not None: 3526 self.q0.export(outfile, level, namespace_, name_='q0', pretty_print=pretty_print) 3527 if self.Velocity0 is not None: 3528 self.Velocity0.export(outfile, level, namespace_, name_='Velocity0', pretty_print=pretty_print) 3529 if self.Mass is not None: 3530 self.Mass.export(outfile, level, namespace_, name_='Mass', pretty_print=pretty_print) 3531 if self.FInt is not None: 3532 self.FInt.export(outfile, level, namespace_, name_='FInt', pretty_print=pretty_print) 3533 if self.FExt is not None: 3534 self.FExt.export(outfile, level, namespace_, name_='FExt', pretty_print=pretty_print) 3535 if self.FGyr is not None: 3536 self.FGyr.export(outfile, level, namespace_, name_='FGyr', pretty_print=pretty_print) 3537 if self.JacobianQFInt is not None: 3538 self.JacobianQFInt.export(outfile, level, namespace_, name_='JacobianQFInt', pretty_print=pretty_print) 3539 if self.JacobianVelocityFInt is not None: 3540 self.JacobianVelocityFInt.export(outfile, level, namespace_, name_='JacobianVelocityFInt', pretty_print=pretty_print) 3541 if self.JacobianQFGyr is not None: 3542 self.JacobianQFGyr.export(outfile, level, namespace_, name_='JacobianQFGyr', pretty_print=pretty_print) 3543 if self.JacobianVelocityFGyr is not None: 3544 self.JacobianVelocityFGyr.export(outfile, level, namespace_, name_='JacobianVelocityFGyr', pretty_print=pretty_print) 3545 def exportLiteral(self, outfile, level, name_='LagrangianDSType'): 3546 level += 1 3547 already_processed = set() 3548 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3549 if self.hasContent_(): 3550 self.exportLiteralChildren(outfile, level, name_) 3551 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3552 if self.Name is not None and 'Name' not in already_processed: 3553 already_processed.add('Name') 3554 showIndent(outfile, level) 3555 outfile.write('Name="%s",\n' % (self.Name,)) 3556 def exportLiteralChildren(self, outfile, level, name_): 3557 if self.q0 is not None: 3558 showIndent(outfile, level) 3559 outfile.write('q0=model_.vector(\n') 3560 self.q0.exportLiteral(outfile, level, name_='q0') 3561 showIndent(outfile, level) 3562 outfile.write('),\n') 3563 if self.Velocity0 is not None: 3564 showIndent(outfile, level) 3565 outfile.write('Velocity0=model_.vector(\n') 3566 self.Velocity0.exportLiteral(outfile, level, name_='Velocity0') 3567 showIndent(outfile, level) 3568 outfile.write('),\n') 3569 if self.Mass is not None: 3570 showIndent(outfile, level) 3571 outfile.write('Mass=model_.matrix(\n') 3572 self.Mass.exportLiteral(outfile, level, name_='Mass') 3573 showIndent(outfile, level) 3574 outfile.write('),\n') 3575 if self.FInt is not None: 3576 showIndent(outfile, level) 3577 outfile.write('FInt=model_.vector(\n') 3578 self.FInt.exportLiteral(outfile, level, name_='FInt') 3579 showIndent(outfile, level) 3580 outfile.write('),\n') 3581 if self.FExt is not None: 3582 showIndent(outfile, level) 3583 outfile.write('FExt=model_.vector(\n') 3584 self.FExt.exportLiteral(outfile, level, name_='FExt') 3585 showIndent(outfile, level) 3586 outfile.write('),\n') 3587 if self.FGyr is not None: 3588 showIndent(outfile, level) 3589 outfile.write('FGyr=model_.vector(\n') 3590 self.FGyr.exportLiteral(outfile, level, name_='FGyr') 3591 showIndent(outfile, level) 3592 outfile.write('),\n') 3593 if self.JacobianQFInt is not None: 3594 showIndent(outfile, level) 3595 outfile.write('JacobianQFInt=model_.matrix(\n') 3596 self.JacobianQFInt.exportLiteral(outfile, level, name_='JacobianQFInt') 3597 showIndent(outfile, level) 3598 outfile.write('),\n') 3599 if self.JacobianVelocityFInt is not None: 3600 showIndent(outfile, level) 3601 outfile.write('JacobianVelocityFInt=model_.matrix(\n') 3602 self.JacobianVelocityFInt.exportLiteral(outfile, level, name_='JacobianVelocityFInt') 3603 showIndent(outfile, level) 3604 outfile.write('),\n') 3605 if self.JacobianQFGyr is not None: 3606 showIndent(outfile, level) 3607 outfile.write('JacobianQFGyr=model_.matrix(\n') 3608 self.JacobianQFGyr.exportLiteral(outfile, level, name_='JacobianQFGyr') 3609 showIndent(outfile, level) 3610 outfile.write('),\n') 3611 if self.JacobianVelocityFGyr is not None: 3612 showIndent(outfile, level) 3613 outfile.write('JacobianVelocityFGyr=model_.matrix(\n') 3614 self.JacobianVelocityFGyr.exportLiteral(outfile, level, name_='JacobianVelocityFGyr') 3615 showIndent(outfile, level) 3616 outfile.write('),\n') 3617 def build(self, node): 3618 already_processed = set() 3619 self.buildAttributes(node, node.attrib, already_processed) 3620 for child in node: 3621 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3622 self.buildChildren(child, node, nodeName_) 3623 return self 3624 def buildAttributes(self, node, attrs, already_processed): 3625 value = find_attr_value_('Name', node) 3626 if value is not None and 'Name' not in already_processed: 3627 already_processed.add('Name') 3628 self.Name = value 3629 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3630 if nodeName_ == 'q0': 3631 obj_ = vector.factory() 3632 obj_.build(child_) 3633 self.q0 = obj_ 3634 elif nodeName_ == 'Velocity0': 3635 obj_ = vector.factory() 3636 obj_.build(child_) 3637 self.Velocity0 = obj_ 3638 elif nodeName_ == 'Mass': 3639 obj_ = matrix.factory() 3640 obj_.build(child_) 3641 self.Mass = obj_ 3642 elif nodeName_ == 'FInt': 3643 obj_ = vector.factory() 3644 obj_.build(child_) 3645 self.FInt = obj_ 3646 elif nodeName_ == 'FExt': 3647 obj_ = vector.factory() 3648 obj_.build(child_) 3649 self.FExt = obj_ 3650 elif nodeName_ == 'FGyr': 3651 obj_ = vector.factory() 3652 obj_.build(child_) 3653 self.FGyr = obj_ 3654 elif nodeName_ == 'JacobianQFInt': 3655 obj_ = matrix.factory() 3656 obj_.build(child_) 3657 self.JacobianQFInt = obj_ 3658 elif nodeName_ == 'JacobianVelocityFInt': 3659 obj_ = matrix.factory() 3660 obj_.build(child_) 3661 self.JacobianVelocityFInt = obj_ 3662 elif nodeName_ == 'JacobianQFGyr': 3663 obj_ = matrix.factory() 3664 obj_.build(child_) 3665 self.JacobianQFGyr = obj_ 3666 elif nodeName_ == 'JacobianVelocityFGyr': 3667 obj_ = matrix.factory() 3668 obj_.build(child_) 3669 self.JacobianVelocityFGyr = obj_ 3670# end class LagrangianDSType 3671 3672 3673class LagrangianLinearTIDSType(GeneratedsSuper): 3674 subclass = None 3675 superclass = None 3676 def __init__(self, Name=None, q0=None, Velocity0=None, Mass=None, FExt=None, K=None, C=None): 3677 self.Name = _cast(None, Name) 3678 self.q0 = q0 3679 self.Velocity0 = Velocity0 3680 self.Mass = Mass 3681 self.FExt = FExt 3682 self.K = K 3683 self.C = C 3684 def factory(*args_, **kwargs_): 3685 if LagrangianLinearTIDSType.subclass: 3686 return LagrangianLinearTIDSType.subclass(*args_, **kwargs_) 3687 else: 3688 return LagrangianLinearTIDSType(*args_, **kwargs_) 3689 factory = staticmethod(factory) 3690 def get_q0(self): return self.q0 3691 def set_q0(self, q0): self.q0 = q0 3692 def get_Velocity0(self): return self.Velocity0 3693 def set_Velocity0(self, Velocity0): self.Velocity0 = Velocity0 3694 def get_Mass(self): return self.Mass 3695 def set_Mass(self, Mass): self.Mass = Mass 3696 def get_FExt(self): return self.FExt 3697 def set_FExt(self, FExt): self.FExt = FExt 3698 def get_K(self): return self.K 3699 def set_K(self, K): self.K = K 3700 def get_C(self): return self.C 3701 def set_C(self, C): self.C = C 3702 def get_Name(self): return self.Name 3703 def set_Name(self, Name): self.Name = Name 3704 def hasContent_(self): 3705 if ( 3706 self.q0 is not None or 3707 self.Velocity0 is not None or 3708 self.Mass is not None or 3709 self.FExt is not None or 3710 self.K is not None or 3711 self.C is not None 3712 ): 3713 return True 3714 else: 3715 return False 3716 def export(self, outfile, level, namespace_='', name_='LagrangianLinearTIDSType', namespacedef_='', pretty_print=True): 3717 if pretty_print: 3718 eol_ = '\n' 3719 else: 3720 eol_ = '' 3721 showIndent(outfile, level, pretty_print) 3722 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3723 already_processed = set() 3724 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianLinearTIDSType') 3725 if self.hasContent_(): 3726 outfile.write('>%s' % (eol_, )) 3727 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianLinearTIDSType', pretty_print=pretty_print) 3728 showIndent(outfile, level, pretty_print) 3729 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3730 else: 3731 outfile.write('/>%s' % (eol_, )) 3732 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianLinearTIDSType'): 3733 if self.Name is not None and 'Name' not in already_processed: 3734 already_processed.add('Name') 3735 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3736 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianLinearTIDSType', fromsubclass_=False, pretty_print=True): 3737 if pretty_print: 3738 eol_ = '\n' 3739 else: 3740 eol_ = '' 3741 if self.q0 is not None: 3742 self.q0.export(outfile, level, namespace_, name_='q0', pretty_print=pretty_print) 3743 if self.Velocity0 is not None: 3744 self.Velocity0.export(outfile, level, namespace_, name_='Velocity0', pretty_print=pretty_print) 3745 if self.Mass is not None: 3746 self.Mass.export(outfile, level, namespace_, name_='Mass', pretty_print=pretty_print) 3747 if self.FExt is not None: 3748 self.FExt.export(outfile, level, namespace_, name_='FExt', pretty_print=pretty_print) 3749 if self.K is not None: 3750 self.K.export(outfile, level, namespace_, name_='K', pretty_print=pretty_print) 3751 if self.C is not None: 3752 self.C.export(outfile, level, namespace_, name_='C', pretty_print=pretty_print) 3753 def exportLiteral(self, outfile, level, name_='LagrangianLinearTIDSType'): 3754 level += 1 3755 already_processed = set() 3756 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3757 if self.hasContent_(): 3758 self.exportLiteralChildren(outfile, level, name_) 3759 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3760 if self.Name is not None and 'Name' not in already_processed: 3761 already_processed.add('Name') 3762 showIndent(outfile, level) 3763 outfile.write('Name="%s",\n' % (self.Name,)) 3764 def exportLiteralChildren(self, outfile, level, name_): 3765 if self.q0 is not None: 3766 showIndent(outfile, level) 3767 outfile.write('q0=model_.vector(\n') 3768 self.q0.exportLiteral(outfile, level, name_='q0') 3769 showIndent(outfile, level) 3770 outfile.write('),\n') 3771 if self.Velocity0 is not None: 3772 showIndent(outfile, level) 3773 outfile.write('Velocity0=model_.vector(\n') 3774 self.Velocity0.exportLiteral(outfile, level, name_='Velocity0') 3775 showIndent(outfile, level) 3776 outfile.write('),\n') 3777 if self.Mass is not None: 3778 showIndent(outfile, level) 3779 outfile.write('Mass=model_.matrix(\n') 3780 self.Mass.exportLiteral(outfile, level, name_='Mass') 3781 showIndent(outfile, level) 3782 outfile.write('),\n') 3783 if self.FExt is not None: 3784 showIndent(outfile, level) 3785 outfile.write('FExt=model_.vector(\n') 3786 self.FExt.exportLiteral(outfile, level, name_='FExt') 3787 showIndent(outfile, level) 3788 outfile.write('),\n') 3789 if self.K is not None: 3790 showIndent(outfile, level) 3791 outfile.write('K=model_.matrix(\n') 3792 self.K.exportLiteral(outfile, level, name_='K') 3793 showIndent(outfile, level) 3794 outfile.write('),\n') 3795 if self.C is not None: 3796 showIndent(outfile, level) 3797 outfile.write('C=model_.matrix(\n') 3798 self.C.exportLiteral(outfile, level, name_='C') 3799 showIndent(outfile, level) 3800 outfile.write('),\n') 3801 def build(self, node): 3802 already_processed = set() 3803 self.buildAttributes(node, node.attrib, already_processed) 3804 for child in node: 3805 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3806 self.buildChildren(child, node, nodeName_) 3807 return self 3808 def buildAttributes(self, node, attrs, already_processed): 3809 value = find_attr_value_('Name', node) 3810 if value is not None and 'Name' not in already_processed: 3811 already_processed.add('Name') 3812 self.Name = value 3813 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3814 if nodeName_ == 'q0': 3815 obj_ = vector.factory() 3816 obj_.build(child_) 3817 self.q0 = obj_ 3818 elif nodeName_ == 'Velocity0': 3819 obj_ = vector.factory() 3820 obj_.build(child_) 3821 self.Velocity0 = obj_ 3822 elif nodeName_ == 'Mass': 3823 obj_ = matrix.factory() 3824 obj_.build(child_) 3825 self.Mass = obj_ 3826 elif nodeName_ == 'FExt': 3827 obj_ = vector.factory() 3828 obj_.build(child_) 3829 self.FExt = obj_ 3830 elif nodeName_ == 'K': 3831 obj_ = matrix.factory() 3832 obj_.build(child_) 3833 self.K = obj_ 3834 elif nodeName_ == 'C': 3835 obj_ = matrix.factory() 3836 obj_.build(child_) 3837 self.C = obj_ 3838# end class LagrangianLinearTIDSType 3839 3840 3841class Interaction_DefinitionType(GeneratedsSuper): 3842 subclass = None 3843 superclass = None 3844 def __init__(self, Interaction=None): 3845 if Interaction is None: 3846 self.Interaction = [] 3847 else: 3848 self.Interaction = Interaction 3849 def factory(*args_, **kwargs_): 3850 if Interaction_DefinitionType.subclass: 3851 return Interaction_DefinitionType.subclass(*args_, **kwargs_) 3852 else: 3853 return Interaction_DefinitionType(*args_, **kwargs_) 3854 factory = staticmethod(factory) 3855 def get_Interaction(self): return self.Interaction 3856 def set_Interaction(self, Interaction): self.Interaction = Interaction 3857 def add_Interaction(self, value): self.Interaction.append(value) 3858 def insert_Interaction(self, index, value): self.Interaction[index] = value 3859 def hasContent_(self): 3860 if ( 3861 self.Interaction 3862 ): 3863 return True 3864 else: 3865 return False 3866 def export(self, outfile, level, namespace_='', name_='Interaction_DefinitionType', namespacedef_='', pretty_print=True): 3867 if pretty_print: 3868 eol_ = '\n' 3869 else: 3870 eol_ = '' 3871 showIndent(outfile, level, pretty_print) 3872 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3873 already_processed = set() 3874 self.exportAttributes(outfile, level, already_processed, namespace_, name_='Interaction_DefinitionType') 3875 if self.hasContent_(): 3876 outfile.write('>%s' % (eol_, )) 3877 self.exportChildren(outfile, level + 1, namespace_='', name_='Interaction_DefinitionType', pretty_print=pretty_print) 3878 showIndent(outfile, level, pretty_print) 3879 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3880 else: 3881 outfile.write('/>%s' % (eol_, )) 3882 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Interaction_DefinitionType'): 3883 pass 3884 def exportChildren(self, outfile, level, namespace_='', name_='Interaction_DefinitionType', fromsubclass_=False, pretty_print=True): 3885 if pretty_print: 3886 eol_ = '\n' 3887 else: 3888 eol_ = '' 3889 for Interaction_ in self.Interaction: 3890 Interaction_.export(outfile, level, namespace_, name_='Interaction', pretty_print=pretty_print) 3891 def exportLiteral(self, outfile, level, name_='Interaction_DefinitionType'): 3892 level += 1 3893 already_processed = set() 3894 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3895 if self.hasContent_(): 3896 self.exportLiteralChildren(outfile, level, name_) 3897 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 3898 pass 3899 def exportLiteralChildren(self, outfile, level, name_): 3900 showIndent(outfile, level) 3901 outfile.write('Interaction=[\n') 3902 level += 1 3903 for Interaction_ in self.Interaction: 3904 showIndent(outfile, level) 3905 outfile.write('model_.InteractionType(\n') 3906 Interaction_.exportLiteral(outfile, level, name_='InteractionType') 3907 showIndent(outfile, level) 3908 outfile.write('),\n') 3909 level -= 1 3910 showIndent(outfile, level) 3911 outfile.write('],\n') 3912 def build(self, node): 3913 already_processed = set() 3914 self.buildAttributes(node, node.attrib, already_processed) 3915 for child in node: 3916 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 3917 self.buildChildren(child, node, nodeName_) 3918 return self 3919 def buildAttributes(self, node, attrs, already_processed): 3920 pass 3921 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 3922 if nodeName_ == 'Interaction': 3923 obj_ = InteractionType.factory() 3924 obj_.build(child_) 3925 self.Interaction.append(obj_) 3926# end class Interaction_DefinitionType 3927 3928 3929class InteractionType(GeneratedsSuper): 3930 subclass = None 3931 superclass = None 3932 def __init__(self, Name=None, size=None, DS_Concerned=None, Interaction_Content=None): 3933 self.Name = _cast(None, Name) 3934 self.size = _cast(int, size) 3935 self.DS_Concerned = DS_Concerned 3936 self.Interaction_Content = Interaction_Content 3937 def factory(*args_, **kwargs_): 3938 if InteractionType.subclass: 3939 return InteractionType.subclass(*args_, **kwargs_) 3940 else: 3941 return InteractionType(*args_, **kwargs_) 3942 factory = staticmethod(factory) 3943 def get_DS_Concerned(self): return self.DS_Concerned 3944 def set_DS_Concerned(self, DS_Concerned): self.DS_Concerned = DS_Concerned 3945 def get_Interaction_Content(self): return self.Interaction_Content 3946 def set_Interaction_Content(self, Interaction_Content): self.Interaction_Content = Interaction_Content 3947 def get_Name(self): return self.Name 3948 def set_Name(self, Name): self.Name = Name 3949 def get_size(self): return self.size 3950 def set_size(self, size): self.size = size 3951 def validate_strList(self, value): 3952 # Validate type strList, a restriction on xsd:string. 3953 pass 3954 def hasContent_(self): 3955 if ( 3956 self.DS_Concerned is not None or 3957 self.Interaction_Content is not None 3958 ): 3959 return True 3960 else: 3961 return False 3962 def export(self, outfile, level, namespace_='', name_='InteractionType', namespacedef_='', pretty_print=True): 3963 if pretty_print: 3964 eol_ = '\n' 3965 else: 3966 eol_ = '' 3967 showIndent(outfile, level, pretty_print) 3968 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 3969 already_processed = set() 3970 self.exportAttributes(outfile, level, already_processed, namespace_, name_='InteractionType') 3971 if self.hasContent_(): 3972 outfile.write('>%s' % (eol_, )) 3973 self.exportChildren(outfile, level + 1, namespace_='', name_='InteractionType', pretty_print=pretty_print) 3974 showIndent(outfile, level, pretty_print) 3975 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 3976 else: 3977 outfile.write('/>%s' % (eol_, )) 3978 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='InteractionType'): 3979 if self.Name is not None and 'Name' not in already_processed: 3980 already_processed.add('Name') 3981 outfile.write(' Name=%s' % (self.gds_format_string(quote_attrib(self.Name).encode(ExternalEncoding), input_name='Name'), )) 3982 if self.size is not None and 'size' not in already_processed: 3983 already_processed.add('size') 3984 outfile.write(' size="%s"' % self.gds_format_integer(self.size, input_name='size')) 3985 def exportChildren(self, outfile, level, namespace_='', name_='InteractionType', fromsubclass_=False, pretty_print=True): 3986 if pretty_print: 3987 eol_ = '\n' 3988 else: 3989 eol_ = '' 3990 if self.DS_Concerned is not None: 3991 showIndent(outfile, level, pretty_print) 3992 outfile.write('<%sDS_Concerned>%s</%sDS_Concerned>%s' % (namespace_, self.gds_format_string(quote_xml(' '.join(self.DS_Concerned)).encode(ExternalEncoding), input_name='DS_Concerned'), namespace_, eol_)) 3993 if self.Interaction_Content is not None: 3994 self.Interaction_Content.export(outfile, level, namespace_, name_='Interaction_Content', pretty_print=pretty_print) 3995 def exportLiteral(self, outfile, level, name_='InteractionType'): 3996 level += 1 3997 already_processed = set() 3998 self.exportLiteralAttributes(outfile, level, already_processed, name_) 3999 if self.hasContent_(): 4000 self.exportLiteralChildren(outfile, level, name_) 4001 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4002 if self.Name is not None and 'Name' not in already_processed: 4003 already_processed.add('Name') 4004 showIndent(outfile, level) 4005 outfile.write('Name="%s",\n' % (self.Name,)) 4006 if self.size is not None and 'size' not in already_processed: 4007 already_processed.add('size') 4008 showIndent(outfile, level) 4009 outfile.write('size=%d,\n' % (self.size,)) 4010 def exportLiteralChildren(self, outfile, level, name_): 4011 if self.DS_Concerned is not None: 4012 showIndent(outfile, level) 4013 if self.DS_Concerned: 4014 outfile.write('DS_Concerned=%s,\n' % quote_python(' '.join(self.DS_Concerned)).encode(ExternalEncoding)) 4015 else: 4016 outfile.write('DS_Concerned=None,\n') 4017 if self.Interaction_Content is not None: 4018 showIndent(outfile, level) 4019 outfile.write('Interaction_Content=model_.Interaction_ContentType(\n') 4020 self.Interaction_Content.exportLiteral(outfile, level, name_='Interaction_Content') 4021 showIndent(outfile, level) 4022 outfile.write('),\n') 4023 def build(self, node): 4024 already_processed = set() 4025 self.buildAttributes(node, node.attrib, already_processed) 4026 for child in node: 4027 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4028 self.buildChildren(child, node, nodeName_) 4029 return self 4030 def buildAttributes(self, node, attrs, already_processed): 4031 value = find_attr_value_('Name', node) 4032 if value is not None and 'Name' not in already_processed: 4033 already_processed.add('Name') 4034 self.Name = value 4035 value = find_attr_value_('size', node) 4036 if value is not None and 'size' not in already_processed: 4037 already_processed.add('size') 4038 try: 4039 self.size = int(value) 4040 except ValueError as exp: 4041 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 4042 if self.size <= 0: 4043 raise_parse_error(node, 'Invalid PositiveInteger') 4044 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4045 if nodeName_ == 'DS_Concerned': 4046 DS_Concerned_ = child_.text 4047 self.DS_Concerned = DS_Concerned_ 4048 self.DS_Concerned = self.DS_Concerned.split() 4049 self.validate_strList(self.DS_Concerned) # validate type strList 4050 elif nodeName_ == 'Interaction_Content': 4051 obj_ = Interaction_ContentType.factory() 4052 obj_.build(child_) 4053 self.Interaction_Content = obj_ 4054# end class InteractionType 4055 4056 4057class Interaction_ContentType(GeneratedsSuper): 4058 subclass = None 4059 superclass = None 4060 def __init__(self, FirstOrderR=None, FirstOrderLinearR=None, FirstOrderLinearTIR=None, LagrangianCompliantR=None, LagrangianRheonomousR=None, LagrangianScleronomousR=None, LagrangianLinearTIR=None, RelayNSL=None, NewtonImpactNSL=None, NewtonImpactFrictionNSL=None, ComplementarityConditionNSL=None): 4061 self.FirstOrderR = FirstOrderR 4062 self.FirstOrderLinearR = FirstOrderLinearR 4063 self.FirstOrderLinearTIR = FirstOrderLinearTIR 4064 self.LagrangianCompliantR = LagrangianCompliantR 4065 self.LagrangianRheonomousR = LagrangianRheonomousR 4066 self.LagrangianScleronomousR = LagrangianScleronomousR 4067 self.LagrangianLinearTIR = LagrangianLinearTIR 4068 self.RelayNSL = RelayNSL 4069 self.NewtonImpactNSL = NewtonImpactNSL 4070 self.NewtonImpactFrictionNSL = NewtonImpactFrictionNSL 4071 self.ComplementarityConditionNSL = ComplementarityConditionNSL 4072 def factory(*args_, **kwargs_): 4073 if Interaction_ContentType.subclass: 4074 return Interaction_ContentType.subclass(*args_, **kwargs_) 4075 else: 4076 return Interaction_ContentType(*args_, **kwargs_) 4077 factory = staticmethod(factory) 4078 def get_FirstOrderR(self): return self.FirstOrderR 4079 def set_FirstOrderR(self, FirstOrderR): self.FirstOrderR = FirstOrderR 4080 def get_FirstOrderLinearR(self): return self.FirstOrderLinearR 4081 def set_FirstOrderLinearR(self, FirstOrderLinearR): self.FirstOrderLinearR = FirstOrderLinearR 4082 def get_FirstOrderLinearTIR(self): return self.FirstOrderLinearTIR 4083 def set_FirstOrderLinearTIR(self, FirstOrderLinearTIR): self.FirstOrderLinearTIR = FirstOrderLinearTIR 4084 def get_LagrangianCompliantR(self): return self.LagrangianCompliantR 4085 def set_LagrangianCompliantR(self, LagrangianCompliantR): self.LagrangianCompliantR = LagrangianCompliantR 4086 def get_LagrangianRheonomousR(self): return self.LagrangianRheonomousR 4087 def set_LagrangianRheonomousR(self, LagrangianRheonomousR): self.LagrangianRheonomousR = LagrangianRheonomousR 4088 def get_LagrangianScleronomousR(self): return self.LagrangianScleronomousR 4089 def set_LagrangianScleronomousR(self, LagrangianScleronomousR): self.LagrangianScleronomousR = LagrangianScleronomousR 4090 def get_LagrangianLinearTIR(self): return self.LagrangianLinearTIR 4091 def set_LagrangianLinearTIR(self, LagrangianLinearTIR): self.LagrangianLinearTIR = LagrangianLinearTIR 4092 def get_RelayNSL(self): return self.RelayNSL 4093 def set_RelayNSL(self, RelayNSL): self.RelayNSL = RelayNSL 4094 def get_NewtonImpactNSL(self): return self.NewtonImpactNSL 4095 def set_NewtonImpactNSL(self, NewtonImpactNSL): self.NewtonImpactNSL = NewtonImpactNSL 4096 def get_NewtonImpactFrictionNSL(self): return self.NewtonImpactFrictionNSL 4097 def set_NewtonImpactFrictionNSL(self, NewtonImpactFrictionNSL): self.NewtonImpactFrictionNSL = NewtonImpactFrictionNSL 4098 def get_ComplementarityConditionNSL(self): return self.ComplementarityConditionNSL 4099 def set_ComplementarityConditionNSL(self, ComplementarityConditionNSL): self.ComplementarityConditionNSL = ComplementarityConditionNSL 4100 def hasContent_(self): 4101 if ( 4102 self.FirstOrderR is not None or 4103 self.FirstOrderLinearR is not None or 4104 self.FirstOrderLinearTIR is not None or 4105 self.LagrangianCompliantR is not None or 4106 self.LagrangianRheonomousR is not None or 4107 self.LagrangianScleronomousR is not None or 4108 self.LagrangianLinearTIR is not None or 4109 self.RelayNSL is not None or 4110 self.NewtonImpactNSL is not None or 4111 self.NewtonImpactFrictionNSL is not None or 4112 self.ComplementarityConditionNSL is not None 4113 ): 4114 return True 4115 else: 4116 return False 4117 def export(self, outfile, level, namespace_='', name_='Interaction_ContentType', namespacedef_='', pretty_print=True): 4118 if pretty_print: 4119 eol_ = '\n' 4120 else: 4121 eol_ = '' 4122 showIndent(outfile, level, pretty_print) 4123 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4124 already_processed = set() 4125 self.exportAttributes(outfile, level, already_processed, namespace_, name_='Interaction_ContentType') 4126 if self.hasContent_(): 4127 outfile.write('>%s' % (eol_, )) 4128 self.exportChildren(outfile, level + 1, namespace_='', name_='Interaction_ContentType', pretty_print=pretty_print) 4129 showIndent(outfile, level, pretty_print) 4130 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4131 else: 4132 outfile.write('/>%s' % (eol_, )) 4133 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Interaction_ContentType'): 4134 pass 4135 def exportChildren(self, outfile, level, namespace_='', name_='Interaction_ContentType', fromsubclass_=False, pretty_print=True): 4136 if pretty_print: 4137 eol_ = '\n' 4138 else: 4139 eol_ = '' 4140 if self.FirstOrderR is not None: 4141 self.FirstOrderR.export(outfile, level, namespace_, name_='FirstOrderR', pretty_print=pretty_print) 4142 if self.FirstOrderLinearR is not None: 4143 self.FirstOrderLinearR.export(outfile, level, namespace_, name_='FirstOrderLinearR', pretty_print=pretty_print) 4144 if self.FirstOrderLinearTIR is not None: 4145 self.FirstOrderLinearTIR.export(outfile, level, namespace_, name_='FirstOrderLinearTIR', pretty_print=pretty_print) 4146 if self.LagrangianCompliantR is not None: 4147 self.LagrangianCompliantR.export(outfile, level, namespace_, name_='LagrangianCompliantR', pretty_print=pretty_print) 4148 if self.LagrangianRheonomousR is not None: 4149 self.LagrangianRheonomousR.export(outfile, level, namespace_, name_='LagrangianRheonomousR', pretty_print=pretty_print) 4150 if self.LagrangianScleronomousR is not None: 4151 self.LagrangianScleronomousR.export(outfile, level, namespace_, name_='LagrangianScleronomousR', pretty_print=pretty_print) 4152 if self.LagrangianLinearTIR is not None: 4153 self.LagrangianLinearTIR.export(outfile, level, namespace_, name_='LagrangianLinearTIR', pretty_print=pretty_print) 4154 if self.RelayNSL is not None: 4155 self.RelayNSL.export(outfile, level, namespace_, name_='RelayNSL', pretty_print=pretty_print) 4156 if self.NewtonImpactNSL is not None: 4157 self.NewtonImpactNSL.export(outfile, level, namespace_, name_='NewtonImpactNSL', pretty_print=pretty_print) 4158 if self.NewtonImpactFrictionNSL is not None: 4159 self.NewtonImpactFrictionNSL.export(outfile, level, namespace_, name_='NewtonImpactFrictionNSL', pretty_print=pretty_print) 4160 if self.ComplementarityConditionNSL is not None: 4161 self.ComplementarityConditionNSL.export(outfile, level, namespace_, name_='ComplementarityConditionNSL', pretty_print=pretty_print) 4162 def exportLiteral(self, outfile, level, name_='Interaction_ContentType'): 4163 level += 1 4164 already_processed = set() 4165 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4166 if self.hasContent_(): 4167 self.exportLiteralChildren(outfile, level, name_) 4168 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4169 pass 4170 def exportLiteralChildren(self, outfile, level, name_): 4171 if self.FirstOrderR is not None: 4172 showIndent(outfile, level) 4173 outfile.write('FirstOrderR=model_.FirstOrderRType(\n') 4174 self.FirstOrderR.exportLiteral(outfile, level, name_='FirstOrderR') 4175 showIndent(outfile, level) 4176 outfile.write('),\n') 4177 if self.FirstOrderLinearR is not None: 4178 showIndent(outfile, level) 4179 outfile.write('FirstOrderLinearR=model_.FirstOrderLinearRType(\n') 4180 self.FirstOrderLinearR.exportLiteral(outfile, level, name_='FirstOrderLinearR') 4181 showIndent(outfile, level) 4182 outfile.write('),\n') 4183 if self.FirstOrderLinearTIR is not None: 4184 showIndent(outfile, level) 4185 outfile.write('FirstOrderLinearTIR=model_.FirstOrderLinearTIRType(\n') 4186 self.FirstOrderLinearTIR.exportLiteral(outfile, level, name_='FirstOrderLinearTIR') 4187 showIndent(outfile, level) 4188 outfile.write('),\n') 4189 if self.LagrangianCompliantR is not None: 4190 showIndent(outfile, level) 4191 outfile.write('LagrangianCompliantR=model_.LagrangianCompliantRType(\n') 4192 self.LagrangianCompliantR.exportLiteral(outfile, level, name_='LagrangianCompliantR') 4193 showIndent(outfile, level) 4194 outfile.write('),\n') 4195 if self.LagrangianRheonomousR is not None: 4196 showIndent(outfile, level) 4197 outfile.write('LagrangianRheonomousR=model_.LagrangianRheonomousRType(\n') 4198 self.LagrangianRheonomousR.exportLiteral(outfile, level, name_='LagrangianRheonomousR') 4199 showIndent(outfile, level) 4200 outfile.write('),\n') 4201 if self.LagrangianScleronomousR is not None: 4202 showIndent(outfile, level) 4203 outfile.write('LagrangianScleronomousR=model_.LagrangianScleronomousRType(\n') 4204 self.LagrangianScleronomousR.exportLiteral(outfile, level, name_='LagrangianScleronomousR') 4205 showIndent(outfile, level) 4206 outfile.write('),\n') 4207 if self.LagrangianLinearTIR is not None: 4208 showIndent(outfile, level) 4209 outfile.write('LagrangianLinearTIR=model_.LagrangianLinearTIRType(\n') 4210 self.LagrangianLinearTIR.exportLiteral(outfile, level, name_='LagrangianLinearTIR') 4211 showIndent(outfile, level) 4212 outfile.write('),\n') 4213 if self.RelayNSL is not None: 4214 showIndent(outfile, level) 4215 outfile.write('RelayNSL=model_.RelayNSLType(\n') 4216 self.RelayNSL.exportLiteral(outfile, level, name_='RelayNSL') 4217 showIndent(outfile, level) 4218 outfile.write('),\n') 4219 if self.NewtonImpactNSL is not None: 4220 showIndent(outfile, level) 4221 outfile.write('NewtonImpactNSL=model_.NewtonImpactNSLType(\n') 4222 self.NewtonImpactNSL.exportLiteral(outfile, level, name_='NewtonImpactNSL') 4223 showIndent(outfile, level) 4224 outfile.write('),\n') 4225 if self.NewtonImpactFrictionNSL is not None: 4226 showIndent(outfile, level) 4227 outfile.write('NewtonImpactFrictionNSL=model_.NewtonImpactFrictionNSLType(\n') 4228 self.NewtonImpactFrictionNSL.exportLiteral(outfile, level, name_='NewtonImpactFrictionNSL') 4229 showIndent(outfile, level) 4230 outfile.write('),\n') 4231 if self.ComplementarityConditionNSL is not None: 4232 showIndent(outfile, level) 4233 outfile.write('ComplementarityConditionNSL=model_.ComplementarityConditionNSLType(\n') 4234 self.ComplementarityConditionNSL.exportLiteral(outfile, level, name_='ComplementarityConditionNSL') 4235 showIndent(outfile, level) 4236 outfile.write('),\n') 4237 def build(self, node): 4238 already_processed = set() 4239 self.buildAttributes(node, node.attrib, already_processed) 4240 for child in node: 4241 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4242 self.buildChildren(child, node, nodeName_) 4243 return self 4244 def buildAttributes(self, node, attrs, already_processed): 4245 pass 4246 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4247 if nodeName_ == 'FirstOrderR': 4248 obj_ = FirstOrderRType.factory() 4249 obj_.build(child_) 4250 self.FirstOrderR = obj_ 4251 elif nodeName_ == 'FirstOrderLinearR': 4252 obj_ = FirstOrderLinearRType.factory() 4253 obj_.build(child_) 4254 self.FirstOrderLinearR = obj_ 4255 elif nodeName_ == 'FirstOrderLinearTIR': 4256 obj_ = FirstOrderLinearTIRType.factory() 4257 obj_.build(child_) 4258 self.FirstOrderLinearTIR = obj_ 4259 elif nodeName_ == 'LagrangianCompliantR': 4260 obj_ = LagrangianCompliantRType.factory() 4261 obj_.build(child_) 4262 self.LagrangianCompliantR = obj_ 4263 elif nodeName_ == 'LagrangianRheonomousR': 4264 obj_ = LagrangianRheonomousRType.factory() 4265 obj_.build(child_) 4266 self.LagrangianRheonomousR = obj_ 4267 elif nodeName_ == 'LagrangianScleronomousR': 4268 obj_ = LagrangianScleronomousRType.factory() 4269 obj_.build(child_) 4270 self.LagrangianScleronomousR = obj_ 4271 elif nodeName_ == 'LagrangianLinearTIR': 4272 obj_ = LagrangianLinearTIRType.factory() 4273 obj_.build(child_) 4274 self.LagrangianLinearTIR = obj_ 4275 elif nodeName_ == 'RelayNSL': 4276 obj_ = RelayNSLType.factory() 4277 obj_.build(child_) 4278 self.RelayNSL = obj_ 4279 elif nodeName_ == 'NewtonImpactNSL': 4280 obj_ = NewtonImpactNSLType.factory() 4281 obj_.build(child_) 4282 self.NewtonImpactNSL = obj_ 4283 elif nodeName_ == 'NewtonImpactFrictionNSL': 4284 obj_ = NewtonImpactFrictionNSLType.factory() 4285 obj_.build(child_) 4286 self.NewtonImpactFrictionNSL = obj_ 4287 elif nodeName_ == 'ComplementarityConditionNSL': 4288 obj_ = ComplementarityConditionNSLType.factory() 4289 obj_.build(child_) 4290 self.ComplementarityConditionNSL = obj_ 4291# end class Interaction_ContentType 4292 4293 4294class FirstOrderRType(GeneratedsSuper): 4295 subclass = None 4296 superclass = None 4297 def __init__(self, type_='Undefined', h=None, g=None, jacobianG=None, jacobianH=None): 4298 self.type_ = _cast(None, type_) 4299 self.h = h 4300 self.g = g 4301 self.jacobianG = jacobianG 4302 self.jacobianH = jacobianH 4303 def factory(*args_, **kwargs_): 4304 if FirstOrderRType.subclass: 4305 return FirstOrderRType.subclass(*args_, **kwargs_) 4306 else: 4307 return FirstOrderRType(*args_, **kwargs_) 4308 factory = staticmethod(factory) 4309 def get_h(self): return self.h 4310 def set_h(self, h): self.h = h 4311 def get_g(self): return self.g 4312 def set_g(self, g): self.g = g 4313 def get_jacobianG(self): return self.jacobianG 4314 def set_jacobianG(self, jacobianG): self.jacobianG = jacobianG 4315 def get_jacobianH(self): return self.jacobianH 4316 def set_jacobianH(self, jacobianH): self.jacobianH = jacobianH 4317 def get_type(self): return self.type_ 4318 def set_type(self, type_): self.type_ = type_ 4319 def hasContent_(self): 4320 if ( 4321 self.h is not None or 4322 self.g is not None or 4323 self.jacobianG is not None or 4324 self.jacobianH is not None 4325 ): 4326 return True 4327 else: 4328 return False 4329 def export(self, outfile, level, namespace_='', name_='FirstOrderRType', namespacedef_='', pretty_print=True): 4330 if pretty_print: 4331 eol_ = '\n' 4332 else: 4333 eol_ = '' 4334 showIndent(outfile, level, pretty_print) 4335 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4336 already_processed = set() 4337 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderRType') 4338 if self.hasContent_(): 4339 outfile.write('>%s' % (eol_, )) 4340 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderRType', pretty_print=pretty_print) 4341 showIndent(outfile, level, pretty_print) 4342 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4343 else: 4344 outfile.write('/>%s' % (eol_, )) 4345 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderRType'): 4346 if self.type_ is not None and 'type_' not in already_processed: 4347 already_processed.add('type_') 4348 outfile.write(' type=%s' % (self.gds_format_string(quote_attrib(self.type_).encode(ExternalEncoding), input_name='type'), )) 4349 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderRType', fromsubclass_=False, pretty_print=True): 4350 if pretty_print: 4351 eol_ = '\n' 4352 else: 4353 eol_ = '' 4354 if self.h is not None: 4355 self.h.export(outfile, level, namespace_, name_='h', pretty_print=pretty_print) 4356 if self.g is not None: 4357 self.g.export(outfile, level, namespace_, name_='g', pretty_print=pretty_print) 4358 if self.jacobianG is not None: 4359 self.jacobianG.export(outfile, level, namespace_, name_='jacobianG', pretty_print=pretty_print) 4360 if self.jacobianH is not None: 4361 self.jacobianH.export(outfile, level, namespace_, name_='jacobianH', pretty_print=pretty_print) 4362 def exportLiteral(self, outfile, level, name_='FirstOrderRType'): 4363 level += 1 4364 already_processed = set() 4365 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4366 if self.hasContent_(): 4367 self.exportLiteralChildren(outfile, level, name_) 4368 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4369 if self.type_ is not None and 'type_' not in already_processed: 4370 already_processed.add('type_') 4371 showIndent(outfile, level) 4372 outfile.write('type_="%s",\n' % (self.type_,)) 4373 def exportLiteralChildren(self, outfile, level, name_): 4374 if self.h is not None: 4375 showIndent(outfile, level) 4376 outfile.write('h=model_.pluginDef(\n') 4377 self.h.exportLiteral(outfile, level, name_='h') 4378 showIndent(outfile, level) 4379 outfile.write('),\n') 4380 if self.g is not None: 4381 showIndent(outfile, level) 4382 outfile.write('g=model_.pluginDef(\n') 4383 self.g.exportLiteral(outfile, level, name_='g') 4384 showIndent(outfile, level) 4385 outfile.write('),\n') 4386 if self.jacobianG is not None: 4387 showIndent(outfile, level) 4388 outfile.write('jacobianG=model_.listOfMatrices(\n') 4389 self.jacobianG.exportLiteral(outfile, level, name_='jacobianG') 4390 showIndent(outfile, level) 4391 outfile.write('),\n') 4392 if self.jacobianH is not None: 4393 showIndent(outfile, level) 4394 outfile.write('jacobianH=model_.listOfMatrices(\n') 4395 self.jacobianH.exportLiteral(outfile, level, name_='jacobianH') 4396 showIndent(outfile, level) 4397 outfile.write('),\n') 4398 def build(self, node): 4399 already_processed = set() 4400 self.buildAttributes(node, node.attrib, already_processed) 4401 for child in node: 4402 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4403 self.buildChildren(child, node, nodeName_) 4404 return self 4405 def buildAttributes(self, node, attrs, already_processed): 4406 value = find_attr_value_('type', node) 4407 if value is not None and 'type' not in already_processed: 4408 already_processed.add('type') 4409 self.type_ = value 4410 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4411 if nodeName_ == 'h': 4412 obj_ = pluginDef.factory() 4413 obj_.build(child_) 4414 self.h = obj_ 4415 elif nodeName_ == 'g': 4416 obj_ = pluginDef.factory() 4417 obj_.build(child_) 4418 self.g = obj_ 4419 elif nodeName_ == 'jacobianG': 4420 obj_ = listOfMatrices.factory() 4421 obj_.build(child_) 4422 self.jacobianG = obj_ 4423 elif nodeName_ == 'jacobianH': 4424 obj_ = listOfMatrices.factory() 4425 obj_.build(child_) 4426 self.jacobianH = obj_ 4427# end class FirstOrderRType 4428 4429 4430class FirstOrderLinearRType(GeneratedsSuper): 4431 subclass = None 4432 superclass = None 4433 def __init__(self, C=None, D=None, F=None, e=None, B=None): 4434 self.C = C 4435 self.D = D 4436 self.F = F 4437 self.e = e 4438 self.B = B 4439 def factory(*args_, **kwargs_): 4440 if FirstOrderLinearRType.subclass: 4441 return FirstOrderLinearRType.subclass(*args_, **kwargs_) 4442 else: 4443 return FirstOrderLinearRType(*args_, **kwargs_) 4444 factory = staticmethod(factory) 4445 def get_C(self): return self.C 4446 def set_C(self, C): self.C = C 4447 def get_D(self): return self.D 4448 def set_D(self, D): self.D = D 4449 def get_F(self): return self.F 4450 def set_F(self, F): self.F = F 4451 def get_e(self): return self.e 4452 def set_e(self, e): self.e = e 4453 def get_B(self): return self.B 4454 def set_B(self, B): self.B = B 4455 def hasContent_(self): 4456 if ( 4457 self.C is not None or 4458 self.D is not None or 4459 self.F is not None or 4460 self.e is not None or 4461 self.B is not None 4462 ): 4463 return True 4464 else: 4465 return False 4466 def export(self, outfile, level, namespace_='', name_='FirstOrderLinearRType', namespacedef_='', pretty_print=True): 4467 if pretty_print: 4468 eol_ = '\n' 4469 else: 4470 eol_ = '' 4471 showIndent(outfile, level, pretty_print) 4472 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4473 already_processed = set() 4474 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderLinearRType') 4475 if self.hasContent_(): 4476 outfile.write('>%s' % (eol_, )) 4477 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderLinearRType', pretty_print=pretty_print) 4478 showIndent(outfile, level, pretty_print) 4479 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4480 else: 4481 outfile.write('/>%s' % (eol_, )) 4482 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderLinearRType'): 4483 pass 4484 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderLinearRType', fromsubclass_=False, pretty_print=True): 4485 if pretty_print: 4486 eol_ = '\n' 4487 else: 4488 eol_ = '' 4489 if self.C is not None: 4490 self.C.export(outfile, level, namespace_, name_='C', pretty_print=pretty_print) 4491 if self.D is not None: 4492 self.D.export(outfile, level, namespace_, name_='D', pretty_print=pretty_print) 4493 if self.F is not None: 4494 self.F.export(outfile, level, namespace_, name_='F', pretty_print=pretty_print) 4495 if self.e is not None: 4496 self.e.export(outfile, level, namespace_, name_='e', pretty_print=pretty_print) 4497 if self.B is not None: 4498 self.B.export(outfile, level, namespace_, name_='B', pretty_print=pretty_print) 4499 def exportLiteral(self, outfile, level, name_='FirstOrderLinearRType'): 4500 level += 1 4501 already_processed = set() 4502 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4503 if self.hasContent_(): 4504 self.exportLiteralChildren(outfile, level, name_) 4505 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4506 pass 4507 def exportLiteralChildren(self, outfile, level, name_): 4508 if self.C is not None: 4509 showIndent(outfile, level) 4510 outfile.write('C=model_.matrix(\n') 4511 self.C.exportLiteral(outfile, level, name_='C') 4512 showIndent(outfile, level) 4513 outfile.write('),\n') 4514 if self.D is not None: 4515 showIndent(outfile, level) 4516 outfile.write('D=model_.matrix(\n') 4517 self.D.exportLiteral(outfile, level, name_='D') 4518 showIndent(outfile, level) 4519 outfile.write('),\n') 4520 if self.F is not None: 4521 showIndent(outfile, level) 4522 outfile.write('F=model_.matrix(\n') 4523 self.F.exportLiteral(outfile, level, name_='F') 4524 showIndent(outfile, level) 4525 outfile.write('),\n') 4526 if self.e is not None: 4527 showIndent(outfile, level) 4528 outfile.write('e=model_.vector(\n') 4529 self.e.exportLiteral(outfile, level, name_='e') 4530 showIndent(outfile, level) 4531 outfile.write('),\n') 4532 if self.B is not None: 4533 showIndent(outfile, level) 4534 outfile.write('B=model_.matrix(\n') 4535 self.B.exportLiteral(outfile, level, name_='B') 4536 showIndent(outfile, level) 4537 outfile.write('),\n') 4538 def build(self, node): 4539 already_processed = set() 4540 self.buildAttributes(node, node.attrib, already_processed) 4541 for child in node: 4542 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4543 self.buildChildren(child, node, nodeName_) 4544 return self 4545 def buildAttributes(self, node, attrs, already_processed): 4546 pass 4547 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4548 if nodeName_ == 'C': 4549 obj_ = matrix.factory() 4550 obj_.build(child_) 4551 self.C = obj_ 4552 elif nodeName_ == 'D': 4553 obj_ = matrix.factory() 4554 obj_.build(child_) 4555 self.D = obj_ 4556 elif nodeName_ == 'F': 4557 obj_ = matrix.factory() 4558 obj_.build(child_) 4559 self.F = obj_ 4560 elif nodeName_ == 'e': 4561 obj_ = vector.factory() 4562 obj_.build(child_) 4563 self.e = obj_ 4564 elif nodeName_ == 'B': 4565 obj_ = matrix.factory() 4566 obj_.build(child_) 4567 self.B = obj_ 4568# end class FirstOrderLinearRType 4569 4570 4571class FirstOrderLinearTIRType(GeneratedsSuper): 4572 subclass = None 4573 superclass = None 4574 def __init__(self, C=None, D=None, F=None, e=None, B=None): 4575 self.C = C 4576 self.D = D 4577 self.F = F 4578 self.e = e 4579 self.B = B 4580 def factory(*args_, **kwargs_): 4581 if FirstOrderLinearTIRType.subclass: 4582 return FirstOrderLinearTIRType.subclass(*args_, **kwargs_) 4583 else: 4584 return FirstOrderLinearTIRType(*args_, **kwargs_) 4585 factory = staticmethod(factory) 4586 def get_C(self): return self.C 4587 def set_C(self, C): self.C = C 4588 def get_D(self): return self.D 4589 def set_D(self, D): self.D = D 4590 def get_F(self): return self.F 4591 def set_F(self, F): self.F = F 4592 def get_e(self): return self.e 4593 def set_e(self, e): self.e = e 4594 def get_B(self): return self.B 4595 def set_B(self, B): self.B = B 4596 def hasContent_(self): 4597 if ( 4598 self.C is not None or 4599 self.D is not None or 4600 self.F is not None or 4601 self.e is not None or 4602 self.B is not None 4603 ): 4604 return True 4605 else: 4606 return False 4607 def export(self, outfile, level, namespace_='', name_='FirstOrderLinearTIRType', namespacedef_='', pretty_print=True): 4608 if pretty_print: 4609 eol_ = '\n' 4610 else: 4611 eol_ = '' 4612 showIndent(outfile, level, pretty_print) 4613 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4614 already_processed = set() 4615 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FirstOrderLinearTIRType') 4616 if self.hasContent_(): 4617 outfile.write('>%s' % (eol_, )) 4618 self.exportChildren(outfile, level + 1, namespace_='', name_='FirstOrderLinearTIRType', pretty_print=pretty_print) 4619 showIndent(outfile, level, pretty_print) 4620 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4621 else: 4622 outfile.write('/>%s' % (eol_, )) 4623 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FirstOrderLinearTIRType'): 4624 pass 4625 def exportChildren(self, outfile, level, namespace_='', name_='FirstOrderLinearTIRType', fromsubclass_=False, pretty_print=True): 4626 if pretty_print: 4627 eol_ = '\n' 4628 else: 4629 eol_ = '' 4630 if self.C is not None: 4631 self.C.export(outfile, level, namespace_, name_='C', pretty_print=pretty_print) 4632 if self.D is not None: 4633 self.D.export(outfile, level, namespace_, name_='D', pretty_print=pretty_print) 4634 if self.F is not None: 4635 self.F.export(outfile, level, namespace_, name_='F', pretty_print=pretty_print) 4636 if self.e is not None: 4637 self.e.export(outfile, level, namespace_, name_='e', pretty_print=pretty_print) 4638 if self.B is not None: 4639 self.B.export(outfile, level, namespace_, name_='B', pretty_print=pretty_print) 4640 def exportLiteral(self, outfile, level, name_='FirstOrderLinearTIRType'): 4641 level += 1 4642 already_processed = set() 4643 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4644 if self.hasContent_(): 4645 self.exportLiteralChildren(outfile, level, name_) 4646 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4647 pass 4648 def exportLiteralChildren(self, outfile, level, name_): 4649 if self.C is not None: 4650 showIndent(outfile, level) 4651 outfile.write('C=model_.matrix(\n') 4652 self.C.exportLiteral(outfile, level, name_='C') 4653 showIndent(outfile, level) 4654 outfile.write('),\n') 4655 if self.D is not None: 4656 showIndent(outfile, level) 4657 outfile.write('D=model_.matrix(\n') 4658 self.D.exportLiteral(outfile, level, name_='D') 4659 showIndent(outfile, level) 4660 outfile.write('),\n') 4661 if self.F is not None: 4662 showIndent(outfile, level) 4663 outfile.write('F=model_.matrix(\n') 4664 self.F.exportLiteral(outfile, level, name_='F') 4665 showIndent(outfile, level) 4666 outfile.write('),\n') 4667 if self.e is not None: 4668 showIndent(outfile, level) 4669 outfile.write('e=model_.vector(\n') 4670 self.e.exportLiteral(outfile, level, name_='e') 4671 showIndent(outfile, level) 4672 outfile.write('),\n') 4673 if self.B is not None: 4674 showIndent(outfile, level) 4675 outfile.write('B=model_.matrix(\n') 4676 self.B.exportLiteral(outfile, level, name_='B') 4677 showIndent(outfile, level) 4678 outfile.write('),\n') 4679 def build(self, node): 4680 already_processed = set() 4681 self.buildAttributes(node, node.attrib, already_processed) 4682 for child in node: 4683 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4684 self.buildChildren(child, node, nodeName_) 4685 return self 4686 def buildAttributes(self, node, attrs, already_processed): 4687 pass 4688 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4689 if nodeName_ == 'C': 4690 obj_ = matrix.factory() 4691 obj_.build(child_) 4692 self.C = obj_ 4693 elif nodeName_ == 'D': 4694 obj_ = matrix.factory() 4695 obj_.build(child_) 4696 self.D = obj_ 4697 elif nodeName_ == 'F': 4698 obj_ = matrix.factory() 4699 obj_.build(child_) 4700 self.F = obj_ 4701 elif nodeName_ == 'e': 4702 obj_ = vector.factory() 4703 obj_.build(child_) 4704 self.e = obj_ 4705 elif nodeName_ == 'B': 4706 obj_ = matrix.factory() 4707 obj_.build(child_) 4708 self.B = obj_ 4709# end class FirstOrderLinearTIRType 4710 4711 4712class LagrangianCompliantRType(GeneratedsSuper): 4713 subclass = None 4714 superclass = None 4715 def __init__(self, h=None, Jacobianhq=None, Jacobianhlambda=None): 4716 self.h = h 4717 self.Jacobianhq = Jacobianhq 4718 self.Jacobianhlambda = Jacobianhlambda 4719 def factory(*args_, **kwargs_): 4720 if LagrangianCompliantRType.subclass: 4721 return LagrangianCompliantRType.subclass(*args_, **kwargs_) 4722 else: 4723 return LagrangianCompliantRType(*args_, **kwargs_) 4724 factory = staticmethod(factory) 4725 def get_h(self): return self.h 4726 def set_h(self, h): self.h = h 4727 def get_Jacobianhq(self): return self.Jacobianhq 4728 def set_Jacobianhq(self, Jacobianhq): self.Jacobianhq = Jacobianhq 4729 def get_Jacobianhlambda(self): return self.Jacobianhlambda 4730 def set_Jacobianhlambda(self, Jacobianhlambda): self.Jacobianhlambda = Jacobianhlambda 4731 def hasContent_(self): 4732 if ( 4733 self.h is not None or 4734 self.Jacobianhq is not None or 4735 self.Jacobianhlambda is not None 4736 ): 4737 return True 4738 else: 4739 return False 4740 def export(self, outfile, level, namespace_='', name_='LagrangianCompliantRType', namespacedef_='', pretty_print=True): 4741 if pretty_print: 4742 eol_ = '\n' 4743 else: 4744 eol_ = '' 4745 showIndent(outfile, level, pretty_print) 4746 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4747 already_processed = set() 4748 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianCompliantRType') 4749 if self.hasContent_(): 4750 outfile.write('>%s' % (eol_, )) 4751 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianCompliantRType', pretty_print=pretty_print) 4752 showIndent(outfile, level, pretty_print) 4753 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4754 else: 4755 outfile.write('/>%s' % (eol_, )) 4756 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianCompliantRType'): 4757 pass 4758 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianCompliantRType', fromsubclass_=False, pretty_print=True): 4759 if pretty_print: 4760 eol_ = '\n' 4761 else: 4762 eol_ = '' 4763 if self.h is not None: 4764 self.h.export(outfile, level, namespace_, name_='h', pretty_print=pretty_print) 4765 if self.Jacobianhq is not None: 4766 self.Jacobianhq.export(outfile, level, namespace_, name_='Jacobianhq', pretty_print=pretty_print) 4767 if self.Jacobianhlambda is not None: 4768 self.Jacobianhlambda.export(outfile, level, namespace_, name_='Jacobianhlambda', pretty_print=pretty_print) 4769 def exportLiteral(self, outfile, level, name_='LagrangianCompliantRType'): 4770 level += 1 4771 already_processed = set() 4772 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4773 if self.hasContent_(): 4774 self.exportLiteralChildren(outfile, level, name_) 4775 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4776 pass 4777 def exportLiteralChildren(self, outfile, level, name_): 4778 if self.h is not None: 4779 showIndent(outfile, level) 4780 outfile.write('h=model_.pluginDef(\n') 4781 self.h.exportLiteral(outfile, level, name_='h') 4782 showIndent(outfile, level) 4783 outfile.write('),\n') 4784 if self.Jacobianhq is not None: 4785 showIndent(outfile, level) 4786 outfile.write('Jacobianhq=model_.pluginDef(\n') 4787 self.Jacobianhq.exportLiteral(outfile, level, name_='Jacobianhq') 4788 showIndent(outfile, level) 4789 outfile.write('),\n') 4790 if self.Jacobianhlambda is not None: 4791 showIndent(outfile, level) 4792 outfile.write('Jacobianhlambda=model_.pluginDef(\n') 4793 self.Jacobianhlambda.exportLiteral(outfile, level, name_='Jacobianhlambda') 4794 showIndent(outfile, level) 4795 outfile.write('),\n') 4796 def build(self, node): 4797 already_processed = set() 4798 self.buildAttributes(node, node.attrib, already_processed) 4799 for child in node: 4800 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4801 self.buildChildren(child, node, nodeName_) 4802 return self 4803 def buildAttributes(self, node, attrs, already_processed): 4804 pass 4805 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4806 if nodeName_ == 'h': 4807 obj_ = pluginDef.factory() 4808 obj_.build(child_) 4809 self.h = obj_ 4810 elif nodeName_ == 'Jacobianhq': 4811 obj_ = pluginDef.factory() 4812 obj_.build(child_) 4813 self.Jacobianhq = obj_ 4814 elif nodeName_ == 'Jacobianhlambda': 4815 obj_ = pluginDef.factory() 4816 obj_.build(child_) 4817 self.Jacobianhlambda = obj_ 4818# end class LagrangianCompliantRType 4819 4820 4821class LagrangianRheonomousRType(GeneratedsSuper): 4822 subclass = None 4823 superclass = None 4824 def __init__(self, h=None, Jacobianhq=None, JacobianDoth=None): 4825 self.h = h 4826 self.Jacobianhq = Jacobianhq 4827 self.JacobianDoth = JacobianDoth 4828 def factory(*args_, **kwargs_): 4829 if LagrangianRheonomousRType.subclass: 4830 return LagrangianRheonomousRType.subclass(*args_, **kwargs_) 4831 else: 4832 return LagrangianRheonomousRType(*args_, **kwargs_) 4833 factory = staticmethod(factory) 4834 def get_h(self): return self.h 4835 def set_h(self, h): self.h = h 4836 def get_Jacobianhq(self): return self.Jacobianhq 4837 def set_Jacobianhq(self, Jacobianhq): self.Jacobianhq = Jacobianhq 4838 def get_JacobianDoth(self): return self.JacobianDoth 4839 def set_JacobianDoth(self, JacobianDoth): self.JacobianDoth = JacobianDoth 4840 def hasContent_(self): 4841 if ( 4842 self.h is not None or 4843 self.Jacobianhq is not None or 4844 self.JacobianDoth is not None 4845 ): 4846 return True 4847 else: 4848 return False 4849 def export(self, outfile, level, namespace_='', name_='LagrangianRheonomousRType', namespacedef_='', pretty_print=True): 4850 if pretty_print: 4851 eol_ = '\n' 4852 else: 4853 eol_ = '' 4854 showIndent(outfile, level, pretty_print) 4855 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4856 already_processed = set() 4857 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianRheonomousRType') 4858 if self.hasContent_(): 4859 outfile.write('>%s' % (eol_, )) 4860 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianRheonomousRType', pretty_print=pretty_print) 4861 showIndent(outfile, level, pretty_print) 4862 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4863 else: 4864 outfile.write('/>%s' % (eol_, )) 4865 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianRheonomousRType'): 4866 pass 4867 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianRheonomousRType', fromsubclass_=False, pretty_print=True): 4868 if pretty_print: 4869 eol_ = '\n' 4870 else: 4871 eol_ = '' 4872 if self.h is not None: 4873 self.h.export(outfile, level, namespace_, name_='h', pretty_print=pretty_print) 4874 if self.Jacobianhq is not None: 4875 self.Jacobianhq.export(outfile, level, namespace_, name_='Jacobianhq', pretty_print=pretty_print) 4876 if self.JacobianDoth is not None: 4877 self.JacobianDoth.export(outfile, level, namespace_, name_='JacobianDoth', pretty_print=pretty_print) 4878 def exportLiteral(self, outfile, level, name_='LagrangianRheonomousRType'): 4879 level += 1 4880 already_processed = set() 4881 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4882 if self.hasContent_(): 4883 self.exportLiteralChildren(outfile, level, name_) 4884 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4885 pass 4886 def exportLiteralChildren(self, outfile, level, name_): 4887 if self.h is not None: 4888 showIndent(outfile, level) 4889 outfile.write('h=model_.pluginDef(\n') 4890 self.h.exportLiteral(outfile, level, name_='h') 4891 showIndent(outfile, level) 4892 outfile.write('),\n') 4893 if self.Jacobianhq is not None: 4894 showIndent(outfile, level) 4895 outfile.write('Jacobianhq=model_.pluginDef(\n') 4896 self.Jacobianhq.exportLiteral(outfile, level, name_='Jacobianhq') 4897 showIndent(outfile, level) 4898 outfile.write('),\n') 4899 if self.JacobianDoth is not None: 4900 showIndent(outfile, level) 4901 outfile.write('JacobianDoth=model_.pluginDef(\n') 4902 self.JacobianDoth.exportLiteral(outfile, level, name_='JacobianDoth') 4903 showIndent(outfile, level) 4904 outfile.write('),\n') 4905 def build(self, node): 4906 already_processed = set() 4907 self.buildAttributes(node, node.attrib, already_processed) 4908 for child in node: 4909 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 4910 self.buildChildren(child, node, nodeName_) 4911 return self 4912 def buildAttributes(self, node, attrs, already_processed): 4913 pass 4914 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 4915 if nodeName_ == 'h': 4916 obj_ = pluginDef.factory() 4917 obj_.build(child_) 4918 self.h = obj_ 4919 elif nodeName_ == 'Jacobianhq': 4920 obj_ = pluginDef.factory() 4921 obj_.build(child_) 4922 self.Jacobianhq = obj_ 4923 elif nodeName_ == 'JacobianDoth': 4924 obj_ = pluginDef.factory() 4925 obj_.build(child_) 4926 self.JacobianDoth = obj_ 4927# end class LagrangianRheonomousRType 4928 4929 4930class LagrangianScleronomousRType(GeneratedsSuper): 4931 subclass = None 4932 superclass = None 4933 def __init__(self, h=None, Jacobianhq=None, JacobianDothq=None): 4934 self.h = h 4935 self.Jacobianhq = Jacobianhq 4936 self.JacobianDothq = JacobianDothq 4937 def factory(*args_, **kwargs_): 4938 if LagrangianScleronomousRType.subclass: 4939 return LagrangianScleronomousRType.subclass(*args_, **kwargs_) 4940 else: 4941 return LagrangianScleronomousRType(*args_, **kwargs_) 4942 factory = staticmethod(factory) 4943 def get_h(self): return self.h 4944 def set_h(self, h): self.h = h 4945 def get_Jacobianhq(self): return self.Jacobianhq 4946 def set_Jacobianhq(self, Jacobianhq): self.Jacobianhq = Jacobianhq 4947 def get_JacobianDothq(self): return self.JacobianDothq 4948 def set_JacobianDothq(self, JacobianDothq): self.JacobianDothq = JacobianDothq 4949 def hasContent_(self): 4950 if ( 4951 self.h is not None or 4952 self.Jacobianhq is not None or 4953 self.JacobianDothq is not None 4954 ): 4955 return True 4956 else: 4957 return False 4958 def export(self, outfile, level, namespace_='', name_='LagrangianScleronomousRType', namespacedef_='', pretty_print=True): 4959 if pretty_print: 4960 eol_ = '\n' 4961 else: 4962 eol_ = '' 4963 showIndent(outfile, level, pretty_print) 4964 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 4965 already_processed = set() 4966 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianScleronomousRType') 4967 if self.hasContent_(): 4968 outfile.write('>%s' % (eol_, )) 4969 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianScleronomousRType', pretty_print=pretty_print) 4970 showIndent(outfile, level, pretty_print) 4971 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 4972 else: 4973 outfile.write('/>%s' % (eol_, )) 4974 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianScleronomousRType'): 4975 pass 4976 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianScleronomousRType', fromsubclass_=False, pretty_print=True): 4977 if pretty_print: 4978 eol_ = '\n' 4979 else: 4980 eol_ = '' 4981 if self.h is not None: 4982 self.h.export(outfile, level, namespace_, name_='h', pretty_print=pretty_print) 4983 if self.Jacobianhq is not None: 4984 self.Jacobianhq.export(outfile, level, namespace_, name_='Jacobianhq', pretty_print=pretty_print) 4985 if self.JacobianDothq is not None: 4986 self.JacobianDothq.export(outfile, level, namespace_, name_='JacobianDothq', pretty_print=pretty_print) 4987 def exportLiteral(self, outfile, level, name_='LagrangianScleronomousRType'): 4988 level += 1 4989 already_processed = set() 4990 self.exportLiteralAttributes(outfile, level, already_processed, name_) 4991 if self.hasContent_(): 4992 self.exportLiteralChildren(outfile, level, name_) 4993 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 4994 pass 4995 def exportLiteralChildren(self, outfile, level, name_): 4996 if self.h is not None: 4997 showIndent(outfile, level) 4998 outfile.write('h=model_.pluginDef(\n') 4999 self.h.exportLiteral(outfile, level, name_='h') 5000 showIndent(outfile, level) 5001 outfile.write('),\n') 5002 if self.Jacobianhq is not None: 5003 showIndent(outfile, level) 5004 outfile.write('Jacobianhq=model_.pluginDef(\n') 5005 self.Jacobianhq.exportLiteral(outfile, level, name_='Jacobianhq') 5006 showIndent(outfile, level) 5007 outfile.write('),\n') 5008 if self.JacobianDothq is not None: 5009 showIndent(outfile, level) 5010 outfile.write('JacobianDothq=model_.pluginDef(\n') 5011 self.JacobianDothq.exportLiteral(outfile, level, name_='JacobianDothq') 5012 showIndent(outfile, level) 5013 outfile.write('),\n') 5014 def build(self, node): 5015 already_processed = set() 5016 self.buildAttributes(node, node.attrib, already_processed) 5017 for child in node: 5018 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5019 self.buildChildren(child, node, nodeName_) 5020 return self 5021 def buildAttributes(self, node, attrs, already_processed): 5022 pass 5023 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5024 if nodeName_ == 'h': 5025 obj_ = pluginDef.factory() 5026 obj_.build(child_) 5027 self.h = obj_ 5028 elif nodeName_ == 'Jacobianhq': 5029 obj_ = pluginDef.factory() 5030 obj_.build(child_) 5031 self.Jacobianhq = obj_ 5032 elif nodeName_ == 'JacobianDothq': 5033 obj_ = pluginDef.factory() 5034 obj_.build(child_) 5035 self.JacobianDothq = obj_ 5036# end class LagrangianScleronomousRType 5037 5038 5039class LagrangianLinearTIRType(GeneratedsSuper): 5040 subclass = None 5041 superclass = None 5042 def __init__(self, C=None, D=None, F=None, e=None): 5043 self.C = C 5044 self.D = D 5045 self.F = F 5046 self.e = e 5047 def factory(*args_, **kwargs_): 5048 if LagrangianLinearTIRType.subclass: 5049 return LagrangianLinearTIRType.subclass(*args_, **kwargs_) 5050 else: 5051 return LagrangianLinearTIRType(*args_, **kwargs_) 5052 factory = staticmethod(factory) 5053 def get_C(self): return self.C 5054 def set_C(self, C): self.C = C 5055 def get_D(self): return self.D 5056 def set_D(self, D): self.D = D 5057 def get_F(self): return self.F 5058 def set_F(self, F): self.F = F 5059 def get_e(self): return self.e 5060 def set_e(self, e): self.e = e 5061 def hasContent_(self): 5062 if ( 5063 self.C is not None or 5064 self.D is not None or 5065 self.F is not None or 5066 self.e is not None 5067 ): 5068 return True 5069 else: 5070 return False 5071 def export(self, outfile, level, namespace_='', name_='LagrangianLinearTIRType', namespacedef_='', pretty_print=True): 5072 if pretty_print: 5073 eol_ = '\n' 5074 else: 5075 eol_ = '' 5076 showIndent(outfile, level, pretty_print) 5077 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5078 already_processed = set() 5079 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LagrangianLinearTIRType') 5080 if self.hasContent_(): 5081 outfile.write('>%s' % (eol_, )) 5082 self.exportChildren(outfile, level + 1, namespace_='', name_='LagrangianLinearTIRType', pretty_print=pretty_print) 5083 showIndent(outfile, level, pretty_print) 5084 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5085 else: 5086 outfile.write('/>%s' % (eol_, )) 5087 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LagrangianLinearTIRType'): 5088 pass 5089 def exportChildren(self, outfile, level, namespace_='', name_='LagrangianLinearTIRType', fromsubclass_=False, pretty_print=True): 5090 if pretty_print: 5091 eol_ = '\n' 5092 else: 5093 eol_ = '' 5094 if self.C is not None: 5095 self.C.export(outfile, level, namespace_, name_='C', pretty_print=pretty_print) 5096 if self.D is not None: 5097 self.D.export(outfile, level, namespace_, name_='D', pretty_print=pretty_print) 5098 if self.F is not None: 5099 self.F.export(outfile, level, namespace_, name_='F', pretty_print=pretty_print) 5100 if self.e is not None: 5101 self.e.export(outfile, level, namespace_, name_='e', pretty_print=pretty_print) 5102 def exportLiteral(self, outfile, level, name_='LagrangianLinearTIRType'): 5103 level += 1 5104 already_processed = set() 5105 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5106 if self.hasContent_(): 5107 self.exportLiteralChildren(outfile, level, name_) 5108 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5109 pass 5110 def exportLiteralChildren(self, outfile, level, name_): 5111 if self.C is not None: 5112 showIndent(outfile, level) 5113 outfile.write('C=model_.matrix(\n') 5114 self.C.exportLiteral(outfile, level, name_='C') 5115 showIndent(outfile, level) 5116 outfile.write('),\n') 5117 if self.D is not None: 5118 showIndent(outfile, level) 5119 outfile.write('D=model_.matrix(\n') 5120 self.D.exportLiteral(outfile, level, name_='D') 5121 showIndent(outfile, level) 5122 outfile.write('),\n') 5123 if self.F is not None: 5124 showIndent(outfile, level) 5125 outfile.write('F=model_.matrix(\n') 5126 self.F.exportLiteral(outfile, level, name_='F') 5127 showIndent(outfile, level) 5128 outfile.write('),\n') 5129 if self.e is not None: 5130 showIndent(outfile, level) 5131 outfile.write('e=model_.vector(\n') 5132 self.e.exportLiteral(outfile, level, name_='e') 5133 showIndent(outfile, level) 5134 outfile.write('),\n') 5135 def build(self, node): 5136 already_processed = set() 5137 self.buildAttributes(node, node.attrib, already_processed) 5138 for child in node: 5139 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5140 self.buildChildren(child, node, nodeName_) 5141 return self 5142 def buildAttributes(self, node, attrs, already_processed): 5143 pass 5144 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5145 if nodeName_ == 'C': 5146 obj_ = matrix.factory() 5147 obj_.build(child_) 5148 self.C = obj_ 5149 elif nodeName_ == 'D': 5150 obj_ = matrix.factory() 5151 obj_.build(child_) 5152 self.D = obj_ 5153 elif nodeName_ == 'F': 5154 obj_ = matrix.factory() 5155 obj_.build(child_) 5156 self.F = obj_ 5157 elif nodeName_ == 'e': 5158 obj_ = vector.factory() 5159 obj_.build(child_) 5160 self.e = obj_ 5161# end class LagrangianLinearTIRType 5162 5163 5164class RelayNSLType(NSL): 5165 subclass = None 5166 superclass = NSL 5167 def __init__(self, size=None, ub=None, lb=None): 5168 super(RelayNSLType, self).__init__(size, ) 5169 self.ub = ub 5170 self.lb = lb 5171 def factory(*args_, **kwargs_): 5172 if RelayNSLType.subclass: 5173 return RelayNSLType.subclass(*args_, **kwargs_) 5174 else: 5175 return RelayNSLType(*args_, **kwargs_) 5176 factory = staticmethod(factory) 5177 def get_ub(self): return self.ub 5178 def set_ub(self, ub): self.ub = ub 5179 def get_lb(self): return self.lb 5180 def set_lb(self, lb): self.lb = lb 5181 def hasContent_(self): 5182 if ( 5183 self.ub is not None or 5184 self.lb is not None or 5185 super(RelayNSLType, self).hasContent_() 5186 ): 5187 return True 5188 else: 5189 return False 5190 def export(self, outfile, level, namespace_='', name_='RelayNSLType', namespacedef_='', pretty_print=True): 5191 if pretty_print: 5192 eol_ = '\n' 5193 else: 5194 eol_ = '' 5195 showIndent(outfile, level, pretty_print) 5196 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5197 already_processed = set() 5198 self.exportAttributes(outfile, level, already_processed, namespace_, name_='RelayNSLType') 5199 if self.hasContent_(): 5200 outfile.write('>%s' % (eol_, )) 5201 self.exportChildren(outfile, level + 1, namespace_='', name_='RelayNSLType', pretty_print=pretty_print) 5202 showIndent(outfile, level, pretty_print) 5203 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5204 else: 5205 outfile.write('/>%s' % (eol_, )) 5206 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RelayNSLType'): 5207 super(RelayNSLType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RelayNSLType') 5208 def exportChildren(self, outfile, level, namespace_='', name_='RelayNSLType', fromsubclass_=False, pretty_print=True): 5209 super(RelayNSLType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 5210 if pretty_print: 5211 eol_ = '\n' 5212 else: 5213 eol_ = '' 5214 if self.ub is not None: 5215 showIndent(outfile, level, pretty_print) 5216 outfile.write('<%sub>%s</%sub>%s' % (namespace_, self.gds_format_double(self.ub, input_name='ub'), namespace_, eol_)) 5217 if self.lb is not None: 5218 showIndent(outfile, level, pretty_print) 5219 outfile.write('<%slb>%s</%slb>%s' % (namespace_, self.gds_format_double(self.lb, input_name='lb'), namespace_, eol_)) 5220 def exportLiteral(self, outfile, level, name_='RelayNSLType'): 5221 level += 1 5222 already_processed = set() 5223 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5224 if self.hasContent_(): 5225 self.exportLiteralChildren(outfile, level, name_) 5226 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5227 super(RelayNSLType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 5228 def exportLiteralChildren(self, outfile, level, name_): 5229 super(RelayNSLType, self).exportLiteralChildren(outfile, level, name_) 5230 if self.ub is not None: 5231 showIndent(outfile, level) 5232 outfile.write('ub=%e,\n' % self.ub) 5233 if self.lb is not None: 5234 showIndent(outfile, level) 5235 outfile.write('lb=%e,\n' % self.lb) 5236 def build(self, node): 5237 already_processed = set() 5238 self.buildAttributes(node, node.attrib, already_processed) 5239 for child in node: 5240 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5241 self.buildChildren(child, node, nodeName_) 5242 return self 5243 def buildAttributes(self, node, attrs, already_processed): 5244 super(RelayNSLType, self).buildAttributes(node, attrs, already_processed) 5245 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5246 if nodeName_ == 'ub': 5247 sval_ = child_.text 5248 try: 5249 fval_ = float(sval_) 5250 except (TypeError, ValueError) as exp: 5251 raise_parse_error(child_, 'requires float or double: %s' % exp) 5252 fval_ = self.gds_validate_float(fval_, node, 'ub') 5253 self.ub = fval_ 5254 elif nodeName_ == 'lb': 5255 sval_ = child_.text 5256 try: 5257 fval_ = float(sval_) 5258 except (TypeError, ValueError) as exp: 5259 raise_parse_error(child_, 'requires float or double: %s' % exp) 5260 fval_ = self.gds_validate_float(fval_, node, 'lb') 5261 self.lb = fval_ 5262 super(RelayNSLType, self).buildChildren(child_, node, nodeName_, True) 5263# end class RelayNSLType 5264 5265 5266class NewtonImpactNSLType(NSL): 5267 subclass = None 5268 superclass = NSL 5269 def __init__(self, size=None, e=None): 5270 super(NewtonImpactNSLType, self).__init__(size, ) 5271 self.e = e 5272 def factory(*args_, **kwargs_): 5273 if NewtonImpactNSLType.subclass: 5274 return NewtonImpactNSLType.subclass(*args_, **kwargs_) 5275 else: 5276 return NewtonImpactNSLType(*args_, **kwargs_) 5277 factory = staticmethod(factory) 5278 def get_e(self): return self.e 5279 def set_e(self, e): self.e = e 5280 def hasContent_(self): 5281 if ( 5282 self.e is not None or 5283 super(NewtonImpactNSLType, self).hasContent_() 5284 ): 5285 return True 5286 else: 5287 return False 5288 def export(self, outfile, level, namespace_='', name_='NewtonImpactNSLType', namespacedef_='', pretty_print=True): 5289 if pretty_print: 5290 eol_ = '\n' 5291 else: 5292 eol_ = '' 5293 showIndent(outfile, level, pretty_print) 5294 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5295 already_processed = set() 5296 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NewtonImpactNSLType') 5297 if self.hasContent_(): 5298 outfile.write('>%s' % (eol_, )) 5299 self.exportChildren(outfile, level + 1, namespace_='', name_='NewtonImpactNSLType', pretty_print=pretty_print) 5300 showIndent(outfile, level, pretty_print) 5301 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5302 else: 5303 outfile.write('/>%s' % (eol_, )) 5304 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NewtonImpactNSLType'): 5305 super(NewtonImpactNSLType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NewtonImpactNSLType') 5306 def exportChildren(self, outfile, level, namespace_='', name_='NewtonImpactNSLType', fromsubclass_=False, pretty_print=True): 5307 super(NewtonImpactNSLType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 5308 if pretty_print: 5309 eol_ = '\n' 5310 else: 5311 eol_ = '' 5312 if self.e is not None: 5313 showIndent(outfile, level, pretty_print) 5314 outfile.write('<%se>%s</%se>%s' % (namespace_, self.gds_format_double(self.e, input_name='e'), namespace_, eol_)) 5315 def exportLiteral(self, outfile, level, name_='NewtonImpactNSLType'): 5316 level += 1 5317 already_processed = set() 5318 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5319 if self.hasContent_(): 5320 self.exportLiteralChildren(outfile, level, name_) 5321 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5322 super(NewtonImpactNSLType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 5323 def exportLiteralChildren(self, outfile, level, name_): 5324 super(NewtonImpactNSLType, self).exportLiteralChildren(outfile, level, name_) 5325 if self.e is not None: 5326 showIndent(outfile, level) 5327 outfile.write('e=%e,\n' % self.e) 5328 def build(self, node): 5329 already_processed = set() 5330 self.buildAttributes(node, node.attrib, already_processed) 5331 for child in node: 5332 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5333 self.buildChildren(child, node, nodeName_) 5334 return self 5335 def buildAttributes(self, node, attrs, already_processed): 5336 super(NewtonImpactNSLType, self).buildAttributes(node, attrs, already_processed) 5337 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5338 if nodeName_ == 'e': 5339 sval_ = child_.text 5340 try: 5341 fval_ = float(sval_) 5342 except (TypeError, ValueError) as exp: 5343 raise_parse_error(child_, 'requires float or double: %s' % exp) 5344 fval_ = self.gds_validate_float(fval_, node, 'e') 5345 self.e = fval_ 5346 super(NewtonImpactNSLType, self).buildChildren(child_, node, nodeName_, True) 5347# end class NewtonImpactNSLType 5348 5349 5350class NewtonImpactFrictionNSLType(NSL): 5351 subclass = None 5352 superclass = NSL 5353 def __init__(self, size=None, en=None, et=None, mu=None): 5354 super(NewtonImpactFrictionNSLType, self).__init__(size, ) 5355 self.en = en 5356 self.et = et 5357 self.mu = mu 5358 def factory(*args_, **kwargs_): 5359 if NewtonImpactFrictionNSLType.subclass: 5360 return NewtonImpactFrictionNSLType.subclass(*args_, **kwargs_) 5361 else: 5362 return NewtonImpactFrictionNSLType(*args_, **kwargs_) 5363 factory = staticmethod(factory) 5364 def get_en(self): return self.en 5365 def set_en(self, en): self.en = en 5366 def get_et(self): return self.et 5367 def set_et(self, et): self.et = et 5368 def get_mu(self): return self.mu 5369 def set_mu(self, mu): self.mu = mu 5370 def hasContent_(self): 5371 if ( 5372 self.en is not None or 5373 self.et is not None or 5374 self.mu is not None or 5375 super(NewtonImpactFrictionNSLType, self).hasContent_() 5376 ): 5377 return True 5378 else: 5379 return False 5380 def export(self, outfile, level, namespace_='', name_='NewtonImpactFrictionNSLType', namespacedef_='', pretty_print=True): 5381 if pretty_print: 5382 eol_ = '\n' 5383 else: 5384 eol_ = '' 5385 showIndent(outfile, level, pretty_print) 5386 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5387 already_processed = set() 5388 self.exportAttributes(outfile, level, already_processed, namespace_, name_='NewtonImpactFrictionNSLType') 5389 if self.hasContent_(): 5390 outfile.write('>%s' % (eol_, )) 5391 self.exportChildren(outfile, level + 1, namespace_='', name_='NewtonImpactFrictionNSLType', pretty_print=pretty_print) 5392 showIndent(outfile, level, pretty_print) 5393 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5394 else: 5395 outfile.write('/>%s' % (eol_, )) 5396 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NewtonImpactFrictionNSLType'): 5397 super(NewtonImpactFrictionNSLType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NewtonImpactFrictionNSLType') 5398 def exportChildren(self, outfile, level, namespace_='', name_='NewtonImpactFrictionNSLType', fromsubclass_=False, pretty_print=True): 5399 super(NewtonImpactFrictionNSLType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 5400 if pretty_print: 5401 eol_ = '\n' 5402 else: 5403 eol_ = '' 5404 if self.en is not None: 5405 showIndent(outfile, level, pretty_print) 5406 outfile.write('<%sen>%s</%sen>%s' % (namespace_, self.gds_format_double(self.en, input_name='en'), namespace_, eol_)) 5407 if self.et is not None: 5408 showIndent(outfile, level, pretty_print) 5409 outfile.write('<%set>%s</%set>%s' % (namespace_, self.gds_format_double(self.et, input_name='et'), namespace_, eol_)) 5410 if self.mu is not None: 5411 showIndent(outfile, level, pretty_print) 5412 outfile.write('<%smu>%s</%smu>%s' % (namespace_, self.gds_format_double(self.mu, input_name='mu'), namespace_, eol_)) 5413 def exportLiteral(self, outfile, level, name_='NewtonImpactFrictionNSLType'): 5414 level += 1 5415 already_processed = set() 5416 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5417 if self.hasContent_(): 5418 self.exportLiteralChildren(outfile, level, name_) 5419 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5420 super(NewtonImpactFrictionNSLType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 5421 def exportLiteralChildren(self, outfile, level, name_): 5422 super(NewtonImpactFrictionNSLType, self).exportLiteralChildren(outfile, level, name_) 5423 if self.en is not None: 5424 showIndent(outfile, level) 5425 outfile.write('en=%e,\n' % self.en) 5426 if self.et is not None: 5427 showIndent(outfile, level) 5428 outfile.write('et=%e,\n' % self.et) 5429 if self.mu is not None: 5430 showIndent(outfile, level) 5431 outfile.write('mu=%e,\n' % self.mu) 5432 def build(self, node): 5433 already_processed = set() 5434 self.buildAttributes(node, node.attrib, already_processed) 5435 for child in node: 5436 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5437 self.buildChildren(child, node, nodeName_) 5438 return self 5439 def buildAttributes(self, node, attrs, already_processed): 5440 super(NewtonImpactFrictionNSLType, self).buildAttributes(node, attrs, already_processed) 5441 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5442 if nodeName_ == 'en': 5443 sval_ = child_.text 5444 try: 5445 fval_ = float(sval_) 5446 except (TypeError, ValueError) as exp: 5447 raise_parse_error(child_, 'requires float or double: %s' % exp) 5448 fval_ = self.gds_validate_float(fval_, node, 'en') 5449 self.en = fval_ 5450 elif nodeName_ == 'et': 5451 sval_ = child_.text 5452 try: 5453 fval_ = float(sval_) 5454 except (TypeError, ValueError) as exp: 5455 raise_parse_error(child_, 'requires float or double: %s' % exp) 5456 fval_ = self.gds_validate_float(fval_, node, 'et') 5457 self.et = fval_ 5458 elif nodeName_ == 'mu': 5459 sval_ = child_.text 5460 try: 5461 fval_ = float(sval_) 5462 except (TypeError, ValueError) as exp: 5463 raise_parse_error(child_, 'requires float or double: %s' % exp) 5464 fval_ = self.gds_validate_float(fval_, node, 'mu') 5465 self.mu = fval_ 5466 super(NewtonImpactFrictionNSLType, self).buildChildren(child_, node, nodeName_, True) 5467# end class NewtonImpactFrictionNSLType 5468 5469 5470class ComplementarityConditionNSLType(NSL): 5471 subclass = None 5472 superclass = NSL 5473 def __init__(self, size=None): 5474 super(ComplementarityConditionNSLType, self).__init__(size, ) 5475 pass 5476 def factory(*args_, **kwargs_): 5477 if ComplementarityConditionNSLType.subclass: 5478 return ComplementarityConditionNSLType.subclass(*args_, **kwargs_) 5479 else: 5480 return ComplementarityConditionNSLType(*args_, **kwargs_) 5481 factory = staticmethod(factory) 5482 def hasContent_(self): 5483 if ( 5484 super(ComplementarityConditionNSLType, self).hasContent_() 5485 ): 5486 return True 5487 else: 5488 return False 5489 def export(self, outfile, level, namespace_='', name_='ComplementarityConditionNSLType', namespacedef_='', pretty_print=True): 5490 if pretty_print: 5491 eol_ = '\n' 5492 else: 5493 eol_ = '' 5494 showIndent(outfile, level, pretty_print) 5495 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5496 already_processed = set() 5497 self.exportAttributes(outfile, level, already_processed, namespace_, name_='ComplementarityConditionNSLType') 5498 if self.hasContent_(): 5499 outfile.write('>%s' % (eol_, )) 5500 self.exportChildren(outfile, level + 1, namespace_='', name_='ComplementarityConditionNSLType', pretty_print=pretty_print) 5501 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5502 else: 5503 outfile.write('/>%s' % (eol_, )) 5504 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ComplementarityConditionNSLType'): 5505 super(ComplementarityConditionNSLType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ComplementarityConditionNSLType') 5506 def exportChildren(self, outfile, level, namespace_='', name_='ComplementarityConditionNSLType', fromsubclass_=False, pretty_print=True): 5507 super(ComplementarityConditionNSLType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 5508 pass 5509 def exportLiteral(self, outfile, level, name_='ComplementarityConditionNSLType'): 5510 level += 1 5511 already_processed = set() 5512 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5513 if self.hasContent_(): 5514 self.exportLiteralChildren(outfile, level, name_) 5515 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5516 super(ComplementarityConditionNSLType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 5517 def exportLiteralChildren(self, outfile, level, name_): 5518 super(ComplementarityConditionNSLType, self).exportLiteralChildren(outfile, level, name_) 5519 pass 5520 def build(self, node): 5521 already_processed = set() 5522 self.buildAttributes(node, node.attrib, already_processed) 5523 for child in node: 5524 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5525 self.buildChildren(child, node, nodeName_) 5526 return self 5527 def buildAttributes(self, node, attrs, already_processed): 5528 super(ComplementarityConditionNSLType, self).buildAttributes(node, attrs, already_processed) 5529 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5530 super(ComplementarityConditionNSLType, self).buildChildren(child_, node, nodeName_, True) 5531 pass 5532# end class ComplementarityConditionNSLType 5533 5534 5535class SimulationType(GeneratedsSuper): 5536 subclass = None 5537 superclass = None 5538 def __init__(self, type_=None, TimeDiscretisation=None, OneStepIntegrator_LMGC90=None, OneStepIntegrator_Definition=None, OneStepNSProblems_List=None): 5539 self.type_ = _cast(None, type_) 5540 self.TimeDiscretisation = TimeDiscretisation 5541 self.OneStepIntegrator_LMGC90 = OneStepIntegrator_LMGC90 5542 self.OneStepIntegrator_Definition = OneStepIntegrator_Definition 5543 self.OneStepNSProblems_List = OneStepNSProblems_List 5544 def factory(*args_, **kwargs_): 5545 if SimulationType.subclass: 5546 return SimulationType.subclass(*args_, **kwargs_) 5547 else: 5548 return SimulationType(*args_, **kwargs_) 5549 factory = staticmethod(factory) 5550 def get_TimeDiscretisation(self): return self.TimeDiscretisation 5551 def set_TimeDiscretisation(self, TimeDiscretisation): self.TimeDiscretisation = TimeDiscretisation 5552 def get_OneStepIntegrator_LMGC90(self): return self.OneStepIntegrator_LMGC90 5553 def set_OneStepIntegrator_LMGC90(self, OneStepIntegrator_LMGC90): self.OneStepIntegrator_LMGC90 = OneStepIntegrator_LMGC90 5554 def get_OneStepIntegrator_Definition(self): return self.OneStepIntegrator_Definition 5555 def set_OneStepIntegrator_Definition(self, OneStepIntegrator_Definition): self.OneStepIntegrator_Definition = OneStepIntegrator_Definition 5556 def get_OneStepNSProblems_List(self): return self.OneStepNSProblems_List 5557 def set_OneStepNSProblems_List(self, OneStepNSProblems_List): self.OneStepNSProblems_List = OneStepNSProblems_List 5558 def get_type(self): return self.type_ 5559 def set_type(self, type_): self.type_ = type_ 5560 def validate_PossibleSimulationValues(self, value): 5561 # Validate type PossibleSimulationValues, a restriction on xsd:string. 5562 pass 5563 def hasContent_(self): 5564 if ( 5565 self.TimeDiscretisation is not None or 5566 self.OneStepIntegrator_LMGC90 is not None or 5567 self.OneStepIntegrator_Definition is not None or 5568 self.OneStepNSProblems_List is not None 5569 ): 5570 return True 5571 else: 5572 return False 5573 def export(self, outfile, level, namespace_='', name_='SimulationType', namespacedef_='', pretty_print=True): 5574 if pretty_print: 5575 eol_ = '\n' 5576 else: 5577 eol_ = '' 5578 showIndent(outfile, level, pretty_print) 5579 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5580 already_processed = set() 5581 self.exportAttributes(outfile, level, already_processed, namespace_, name_='SimulationType') 5582 if self.hasContent_(): 5583 outfile.write('>%s' % (eol_, )) 5584 self.exportChildren(outfile, level + 1, namespace_='', name_='SimulationType', pretty_print=pretty_print) 5585 showIndent(outfile, level, pretty_print) 5586 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5587 else: 5588 outfile.write('/>%s' % (eol_, )) 5589 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SimulationType'): 5590 if self.type_ is not None and 'type_' not in already_processed: 5591 already_processed.add('type_') 5592 outfile.write(' type=%s' % (quote_attrib(self.type_), )) 5593 def exportChildren(self, outfile, level, namespace_='', name_='SimulationType', fromsubclass_=False, pretty_print=True): 5594 if pretty_print: 5595 eol_ = '\n' 5596 else: 5597 eol_ = '' 5598 if self.TimeDiscretisation is not None: 5599 self.TimeDiscretisation.export(outfile, level, namespace_, name_='TimeDiscretisation', pretty_print=pretty_print) 5600 if self.OneStepIntegrator_LMGC90 is not None: 5601 self.OneStepIntegrator_LMGC90.export(outfile, level, namespace_, name_='OneStepIntegrator_LMGC90', pretty_print=pretty_print) 5602 if self.OneStepIntegrator_Definition is not None: 5603 self.OneStepIntegrator_Definition.export(outfile, level, namespace_, name_='OneStepIntegrator_Definition', pretty_print=pretty_print) 5604 if self.OneStepNSProblems_List is not None: 5605 self.OneStepNSProblems_List.export(outfile, level, namespace_, name_='OneStepNSProblems_List', pretty_print=pretty_print) 5606 def exportLiteral(self, outfile, level, name_='SimulationType'): 5607 level += 1 5608 already_processed = set() 5609 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5610 if self.hasContent_(): 5611 self.exportLiteralChildren(outfile, level, name_) 5612 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5613 if self.type_ is not None and 'type_' not in already_processed: 5614 already_processed.add('type_') 5615 showIndent(outfile, level) 5616 outfile.write('type_="%s",\n' % (self.type_,)) 5617 def exportLiteralChildren(self, outfile, level, name_): 5618 if self.TimeDiscretisation is not None: 5619 showIndent(outfile, level) 5620 outfile.write('TimeDiscretisation=model_.TimeDiscretisationType(\n') 5621 self.TimeDiscretisation.exportLiteral(outfile, level, name_='TimeDiscretisation') 5622 showIndent(outfile, level) 5623 outfile.write('),\n') 5624 if self.OneStepIntegrator_LMGC90 is not None: 5625 showIndent(outfile, level) 5626 outfile.write('OneStepIntegrator_LMGC90=model_.OneStepIntegrator_LMGC90Type(\n') 5627 self.OneStepIntegrator_LMGC90.exportLiteral(outfile, level, name_='OneStepIntegrator_LMGC90') 5628 showIndent(outfile, level) 5629 outfile.write('),\n') 5630 if self.OneStepIntegrator_Definition is not None: 5631 showIndent(outfile, level) 5632 outfile.write('OneStepIntegrator_Definition=model_.OneStepIntegrator_DefinitionType(\n') 5633 self.OneStepIntegrator_Definition.exportLiteral(outfile, level, name_='OneStepIntegrator_Definition') 5634 showIndent(outfile, level) 5635 outfile.write('),\n') 5636 if self.OneStepNSProblems_List is not None: 5637 showIndent(outfile, level) 5638 outfile.write('OneStepNSProblems_List=model_.OneStepNSProblems_ListType(\n') 5639 self.OneStepNSProblems_List.exportLiteral(outfile, level, name_='OneStepNSProblems_List') 5640 showIndent(outfile, level) 5641 outfile.write('),\n') 5642 def build(self, node): 5643 already_processed = set() 5644 self.buildAttributes(node, node.attrib, already_processed) 5645 for child in node: 5646 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5647 self.buildChildren(child, node, nodeName_) 5648 return self 5649 def buildAttributes(self, node, attrs, already_processed): 5650 value = find_attr_value_('type', node) 5651 if value is not None and 'type' not in already_processed: 5652 already_processed.add('type') 5653 self.type_ = value 5654 self.validate_PossibleSimulationValues(self.type_) # validate type PossibleSimulationValues 5655 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5656 if nodeName_ == 'TimeDiscretisation': 5657 obj_ = TimeDiscretisationType.factory() 5658 obj_.build(child_) 5659 self.TimeDiscretisation = obj_ 5660 elif nodeName_ == 'OneStepIntegrator_LMGC90': 5661 obj_ = OneStepIntegrator_LMGC90Type.factory() 5662 obj_.build(child_) 5663 self.OneStepIntegrator_LMGC90 = obj_ 5664 elif nodeName_ == 'OneStepIntegrator_Definition': 5665 obj_ = OneStepIntegrator_DefinitionType.factory() 5666 obj_.build(child_) 5667 self.OneStepIntegrator_Definition = obj_ 5668 elif nodeName_ == 'OneStepNSProblems_List': 5669 obj_ = OneStepNSProblems_ListType.factory() 5670 obj_.build(child_) 5671 self.OneStepNSProblems_List = obj_ 5672# end class SimulationType 5673 5674 5675class TimeDiscretisationType(GeneratedsSuper): 5676 subclass = None 5677 superclass = None 5678 def __init__(self, tk=None, h=None, N=None): 5679 self.tk = tk 5680 self.h = h 5681 self.N = N 5682 def factory(*args_, **kwargs_): 5683 if TimeDiscretisationType.subclass: 5684 return TimeDiscretisationType.subclass(*args_, **kwargs_) 5685 else: 5686 return TimeDiscretisationType(*args_, **kwargs_) 5687 factory = staticmethod(factory) 5688 def get_tk(self): return self.tk 5689 def set_tk(self, tk): self.tk = tk 5690 def get_h(self): return self.h 5691 def set_h(self, h): self.h = h 5692 def get_N(self): return self.N 5693 def set_N(self, N): self.N = N 5694 def validate_positiveDouble(self, value): 5695 # Validate type positiveDouble, a restriction on xsd:double. 5696 pass 5697 def hasContent_(self): 5698 if ( 5699 self.tk is not None or 5700 self.h is not None or 5701 self.N is not None 5702 ): 5703 return True 5704 else: 5705 return False 5706 def export(self, outfile, level, namespace_='', name_='TimeDiscretisationType', namespacedef_='', pretty_print=True): 5707 if pretty_print: 5708 eol_ = '\n' 5709 else: 5710 eol_ = '' 5711 showIndent(outfile, level, pretty_print) 5712 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5713 already_processed = set() 5714 self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeDiscretisationType') 5715 if self.hasContent_(): 5716 outfile.write('>%s' % (eol_, )) 5717 self.exportChildren(outfile, level + 1, namespace_='', name_='TimeDiscretisationType', pretty_print=pretty_print) 5718 showIndent(outfile, level, pretty_print) 5719 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5720 else: 5721 outfile.write('/>%s' % (eol_, )) 5722 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeDiscretisationType'): 5723 pass 5724 def exportChildren(self, outfile, level, namespace_='', name_='TimeDiscretisationType', fromsubclass_=False, pretty_print=True): 5725 if pretty_print: 5726 eol_ = '\n' 5727 else: 5728 eol_ = '' 5729 if self.tk is not None: 5730 self.tk.export(outfile, level, namespace_, name_='tk', pretty_print=pretty_print) 5731 if self.h is not None: 5732 showIndent(outfile, level, pretty_print) 5733 outfile.write('<%sh>%s</%sh>%s' % (namespace_, self.gds_format_double(self.h, input_name='h'), namespace_, eol_)) 5734 if self.N is not None: 5735 showIndent(outfile, level, pretty_print) 5736 outfile.write('<%sN>%s</%sN>%s' % (namespace_, self.gds_format_integer(self.N, input_name='N'), namespace_, eol_)) 5737 def exportLiteral(self, outfile, level, name_='TimeDiscretisationType'): 5738 level += 1 5739 already_processed = set() 5740 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5741 if self.hasContent_(): 5742 self.exportLiteralChildren(outfile, level, name_) 5743 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5744 pass 5745 def exportLiteralChildren(self, outfile, level, name_): 5746 if self.tk is not None: 5747 showIndent(outfile, level) 5748 outfile.write('tk=model_.vector(\n') 5749 self.tk.exportLiteral(outfile, level, name_='tk') 5750 showIndent(outfile, level) 5751 outfile.write('),\n') 5752 if self.h is not None: 5753 showIndent(outfile, level) 5754 outfile.write('h=%e,\n' % self.h) 5755 if self.N is not None: 5756 showIndent(outfile, level) 5757 outfile.write('N=%d,\n' % self.N) 5758 def build(self, node): 5759 already_processed = set() 5760 self.buildAttributes(node, node.attrib, already_processed) 5761 for child in node: 5762 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5763 self.buildChildren(child, node, nodeName_) 5764 return self 5765 def buildAttributes(self, node, attrs, already_processed): 5766 pass 5767 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5768 if nodeName_ == 'tk': 5769 obj_ = vector.factory() 5770 obj_.build(child_) 5771 self.tk = obj_ 5772 elif nodeName_ == 'h': 5773 sval_ = child_.text 5774 try: 5775 fval_ = float(sval_) 5776 except (TypeError, ValueError) as exp: 5777 raise_parse_error(child_, 'requires float or double: %s' % exp) 5778 fval_ = self.gds_validate_float(fval_, node, 'h') 5779 self.h = fval_ 5780 self.validate_positiveDouble(self.h) # validate type positiveDouble 5781 elif nodeName_ == 'N': 5782 sval_ = child_.text 5783 try: 5784 ival_ = int(sval_) 5785 except (TypeError, ValueError) as exp: 5786 raise_parse_error(child_, 'requires integer: %s' % exp) 5787 if ival_ <= 0: 5788 raise_parse_error(child_, 'requires positiveInteger') 5789 ival_ = self.gds_validate_integer(ival_, node, 'N') 5790 self.N = ival_ 5791# end class TimeDiscretisationType 5792 5793 5794class OneStepIntegrator_LMGC90Type(GeneratedsSuper): 5795 subclass = None 5796 superclass = None 5797 def __init__(self, empty=None): 5798 self.empty = empty 5799 def factory(*args_, **kwargs_): 5800 if OneStepIntegrator_LMGC90Type.subclass: 5801 return OneStepIntegrator_LMGC90Type.subclass(*args_, **kwargs_) 5802 else: 5803 return OneStepIntegrator_LMGC90Type(*args_, **kwargs_) 5804 factory = staticmethod(factory) 5805 def get_empty(self): return self.empty 5806 def set_empty(self, empty): self.empty = empty 5807 def hasContent_(self): 5808 if ( 5809 self.empty is not None 5810 ): 5811 return True 5812 else: 5813 return False 5814 def export(self, outfile, level, namespace_='', name_='OneStepIntegrator_LMGC90Type', namespacedef_='', pretty_print=True): 5815 if pretty_print: 5816 eol_ = '\n' 5817 else: 5818 eol_ = '' 5819 showIndent(outfile, level, pretty_print) 5820 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5821 already_processed = set() 5822 self.exportAttributes(outfile, level, already_processed, namespace_, name_='OneStepIntegrator_LMGC90Type') 5823 if self.hasContent_(): 5824 outfile.write('>%s' % (eol_, )) 5825 self.exportChildren(outfile, level + 1, namespace_='', name_='OneStepIntegrator_LMGC90Type', pretty_print=pretty_print) 5826 showIndent(outfile, level, pretty_print) 5827 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5828 else: 5829 outfile.write('/>%s' % (eol_, )) 5830 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OneStepIntegrator_LMGC90Type'): 5831 pass 5832 def exportChildren(self, outfile, level, namespace_='', name_='OneStepIntegrator_LMGC90Type', fromsubclass_=False, pretty_print=True): 5833 if pretty_print: 5834 eol_ = '\n' 5835 else: 5836 eol_ = '' 5837 if self.empty is not None: 5838 showIndent(outfile, level, pretty_print) 5839 outfile.write('<%sempty>%s</%sempty>%s' % (namespace_, self.gds_format_string(quote_xml(self.empty).encode(ExternalEncoding), input_name='empty'), namespace_, eol_)) 5840 def exportLiteral(self, outfile, level, name_='OneStepIntegrator_LMGC90Type'): 5841 level += 1 5842 already_processed = set() 5843 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5844 if self.hasContent_(): 5845 self.exportLiteralChildren(outfile, level, name_) 5846 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5847 pass 5848 def exportLiteralChildren(self, outfile, level, name_): 5849 if self.empty is not None: 5850 showIndent(outfile, level) 5851 outfile.write('empty=%s,\n' % quote_python(self.empty).encode(ExternalEncoding)) 5852 def build(self, node): 5853 already_processed = set() 5854 self.buildAttributes(node, node.attrib, already_processed) 5855 for child in node: 5856 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5857 self.buildChildren(child, node, nodeName_) 5858 return self 5859 def buildAttributes(self, node, attrs, already_processed): 5860 pass 5861 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5862 if nodeName_ == 'empty': 5863 empty_ = child_.text 5864 empty_ = self.gds_validate_string(empty_, node, 'empty') 5865 self.empty = empty_ 5866# end class OneStepIntegrator_LMGC90Type 5867 5868 5869class OneStepIntegrator_DefinitionType(GeneratedsSuper): 5870 subclass = None 5871 superclass = None 5872 def __init__(self, MoreauJeanOSI=None, LsodarOSI=None): 5873 if MoreauJeanOSI is None: 5874 self.MoreauJeanOSI = [] 5875 else: 5876 self.MoreauJeanOSI = MoreauJeanOSI 5877 if LsodarOSI is None: 5878 self.LsodarOSI = [] 5879 else: 5880 self.LsodarOSI = LsodarOSI 5881 def factory(*args_, **kwargs_): 5882 if OneStepIntegrator_DefinitionType.subclass: 5883 return OneStepIntegrator_DefinitionType.subclass(*args_, **kwargs_) 5884 else: 5885 return OneStepIntegrator_DefinitionType(*args_, **kwargs_) 5886 factory = staticmethod(factory) 5887 def get_MoreauJeanOSI(self): return self.MoreauJeanOSI 5888 def set_MoreauJeanOSI(self, MoreauJeanOSI): self.MoreauJeanOSI = MoreauJeanOSI 5889 def add_MoreauJeanOSI(self, value): self.MoreauJeanOSI.append(value) 5890 def insert_MoreauJeanOSI(self, index, value): self.MoreauJeanOSI[index] = value 5891 def get_LsodarOSI(self): return self.LsodarOSI 5892 def set_LsodarOSI(self, LsodarOSI): self.LsodarOSI = LsodarOSI 5893 def add_LsodarOSI(self, value): self.LsodarOSI.append(value) 5894 def insert_LsodarOSI(self, index, value): self.LsodarOSI[index] = value 5895 def hasContent_(self): 5896 if ( 5897 self.MoreauJeanOSI or 5898 self.LsodarOSI 5899 ): 5900 return True 5901 else: 5902 return False 5903 def export(self, outfile, level, namespace_='', name_='OneStepIntegrator_DefinitionType', namespacedef_='', pretty_print=True): 5904 if pretty_print: 5905 eol_ = '\n' 5906 else: 5907 eol_ = '' 5908 showIndent(outfile, level, pretty_print) 5909 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 5910 already_processed = set() 5911 self.exportAttributes(outfile, level, already_processed, namespace_, name_='OneStepIntegrator_DefinitionType') 5912 if self.hasContent_(): 5913 outfile.write('>%s' % (eol_, )) 5914 self.exportChildren(outfile, level + 1, namespace_='', name_='OneStepIntegrator_DefinitionType', pretty_print=pretty_print) 5915 showIndent(outfile, level, pretty_print) 5916 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 5917 else: 5918 outfile.write('/>%s' % (eol_, )) 5919 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OneStepIntegrator_DefinitionType'): 5920 pass 5921 def exportChildren(self, outfile, level, namespace_='', name_='OneStepIntegrator_DefinitionType', fromsubclass_=False, pretty_print=True): 5922 if pretty_print: 5923 eol_ = '\n' 5924 else: 5925 eol_ = '' 5926 for MoreauJeanOSI_ in self.MoreauJeanOSI: 5927 MoreauJeanOSI_.export(outfile, level, namespace_, name_='MoreauJeanOSI', pretty_print=pretty_print) 5928 for LsodarOSI_ in self.LsodarOSI: 5929 LsodarOSI_.export(outfile, level, namespace_, name_='LsodarOSI', pretty_print=pretty_print) 5930 def exportLiteral(self, outfile, level, name_='OneStepIntegrator_DefinitionType'): 5931 level += 1 5932 already_processed = set() 5933 self.exportLiteralAttributes(outfile, level, already_processed, name_) 5934 if self.hasContent_(): 5935 self.exportLiteralChildren(outfile, level, name_) 5936 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 5937 pass 5938 def exportLiteralChildren(self, outfile, level, name_): 5939 showIndent(outfile, level) 5940 outfile.write('MoreauJeanOSI=[\n') 5941 level += 1 5942 for MoreauJeanOSI_ in self.MoreauJeanOSI: 5943 showIndent(outfile, level) 5944 outfile.write('model_.MoreauJeanOSIType(\n') 5945 MoreauJeanOSI_.exportLiteral(outfile, level, name_='MoreauJeanOSIType') 5946 showIndent(outfile, level) 5947 outfile.write('),\n') 5948 level -= 1 5949 showIndent(outfile, level) 5950 outfile.write('],\n') 5951 showIndent(outfile, level) 5952 outfile.write('LsodarOSI=[\n') 5953 level += 1 5954 for LsodarOSI_ in self.LsodarOSI: 5955 showIndent(outfile, level) 5956 outfile.write('model_.LsodarOSIType(\n') 5957 LsodarOSI_.exportLiteral(outfile, level, name_='LsodarOSIType') 5958 showIndent(outfile, level) 5959 outfile.write('),\n') 5960 level -= 1 5961 showIndent(outfile, level) 5962 outfile.write('],\n') 5963 def build(self, node): 5964 already_processed = set() 5965 self.buildAttributes(node, node.attrib, already_processed) 5966 for child in node: 5967 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 5968 self.buildChildren(child, node, nodeName_) 5969 return self 5970 def buildAttributes(self, node, attrs, already_processed): 5971 pass 5972 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 5973 if nodeName_ == 'MoreauJeanOSI': 5974 obj_ = MoreauJeanOSIType.factory() 5975 obj_.build(child_) 5976 self.MoreauJeanOSI.append(obj_) 5977 elif nodeName_ == 'LsodarOSI': 5978 obj_ = LsodarOSIType.factory() 5979 obj_.build(child_) 5980 self.LsodarOSI.append(obj_) 5981# end class OneStepIntegrator_DefinitionType 5982 5983 5984class MoreauJeanOSIType(OSI): 5985 subclass = None 5986 superclass = OSI 5987 def __init__(self, DS_Concerned=None, Interactions_Concerned=None, Theta=None): 5988 super(MoreauJeanOSIType, self).__init__(DS_Concerned, Interactions_Concerned, ) 5989 self.Theta = Theta 5990 def factory(*args_, **kwargs_): 5991 if MoreauJeanOSIType.subclass: 5992 return MoreauJeanOSIType.subclass(*args_, **kwargs_) 5993 else: 5994 return MoreauJeanOSIType(*args_, **kwargs_) 5995 factory = staticmethod(factory) 5996 def get_Theta(self): return self.Theta 5997 def set_Theta(self, Theta): self.Theta = Theta 5998 def hasContent_(self): 5999 if ( 6000 self.Theta is not None or 6001 super(MoreauJeanOSIType, self).hasContent_() 6002 ): 6003 return True 6004 else: 6005 return False 6006 def export(self, outfile, level, namespace_='', name_='MoreauJeanOSIType', namespacedef_='', pretty_print=True): 6007 if pretty_print: 6008 eol_ = '\n' 6009 else: 6010 eol_ = '' 6011 showIndent(outfile, level, pretty_print) 6012 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6013 already_processed = set() 6014 self.exportAttributes(outfile, level, already_processed, namespace_, name_='MoreauJeanOSIType') 6015 if self.hasContent_(): 6016 outfile.write('>%s' % (eol_, )) 6017 self.exportChildren(outfile, level + 1, namespace_='', name_='MoreauJeanOSIType', pretty_print=pretty_print) 6018 showIndent(outfile, level, pretty_print) 6019 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6020 else: 6021 outfile.write('/>%s' % (eol_, )) 6022 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MoreauJeanOSIType'): 6023 super(MoreauJeanOSIType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MoreauJeanOSIType') 6024 def exportChildren(self, outfile, level, namespace_='', name_='MoreauJeanOSIType', fromsubclass_=False, pretty_print=True): 6025 super(MoreauJeanOSIType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6026 if pretty_print: 6027 eol_ = '\n' 6028 else: 6029 eol_ = '' 6030 if self.Theta is not None: 6031 self.Theta.export(outfile, level, namespace_, name_='Theta', pretty_print=pretty_print) 6032 def exportLiteral(self, outfile, level, name_='MoreauJeanOSIType'): 6033 level += 1 6034 already_processed = set() 6035 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6036 if self.hasContent_(): 6037 self.exportLiteralChildren(outfile, level, name_) 6038 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6039 super(MoreauJeanOSIType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6040 def exportLiteralChildren(self, outfile, level, name_): 6041 super(MoreauJeanOSIType, self).exportLiteralChildren(outfile, level, name_) 6042 if self.Theta is not None: 6043 showIndent(outfile, level) 6044 outfile.write('Theta=model_.emptyType(\n') 6045 self.Theta.exportLiteral(outfile, level, name_='Theta') 6046 showIndent(outfile, level) 6047 outfile.write('),\n') 6048 def build(self, node): 6049 already_processed = set() 6050 self.buildAttributes(node, node.attrib, already_processed) 6051 for child in node: 6052 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6053 self.buildChildren(child, node, nodeName_) 6054 return self 6055 def buildAttributes(self, node, attrs, already_processed): 6056 super(MoreauJeanOSIType, self).buildAttributes(node, attrs, already_processed) 6057 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6058 if nodeName_ == 'Theta': 6059 obj_ = emptyType.factory() 6060 obj_.build(child_) 6061 self.Theta = obj_ 6062 super(MoreauJeanOSIType, self).buildChildren(child_, node, nodeName_, True) 6063# end class MoreauJeanOSIType 6064 6065 6066class LsodarOSIType(OSI): 6067 subclass = None 6068 superclass = OSI 6069 def __init__(self, DS_Concerned=None, Interactions_Concerned=None): 6070 super(LsodarOSIType, self).__init__(DS_Concerned, Interactions_Concerned, ) 6071 pass 6072 def factory(*args_, **kwargs_): 6073 if LsodarOSIType.subclass: 6074 return LsodarOSIType.subclass(*args_, **kwargs_) 6075 else: 6076 return LsodarOSIType(*args_, **kwargs_) 6077 factory = staticmethod(factory) 6078 def hasContent_(self): 6079 if ( 6080 super(LsodarOSIType, self).hasContent_() 6081 ): 6082 return True 6083 else: 6084 return False 6085 def export(self, outfile, level, namespace_='', name_='LsodarOSIType', namespacedef_='', pretty_print=True): 6086 if pretty_print: 6087 eol_ = '\n' 6088 else: 6089 eol_ = '' 6090 showIndent(outfile, level, pretty_print) 6091 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6092 already_processed = set() 6093 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LsodarOSIType') 6094 if self.hasContent_(): 6095 outfile.write('>%s' % (eol_, )) 6096 self.exportChildren(outfile, level + 1, namespace_='', name_='LsodarOSIType', pretty_print=pretty_print) 6097 showIndent(outfile, level, pretty_print) 6098 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6099 else: 6100 outfile.write('/>%s' % (eol_, )) 6101 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LsodarOSIType'): 6102 super(LsodarOSIType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LsodarOSIType') 6103 def exportChildren(self, outfile, level, namespace_='', name_='LsodarOSIType', fromsubclass_=False, pretty_print=True): 6104 super(LsodarOSIType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6105 def exportLiteral(self, outfile, level, name_='LsodarOSIType'): 6106 level += 1 6107 already_processed = set() 6108 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6109 if self.hasContent_(): 6110 self.exportLiteralChildren(outfile, level, name_) 6111 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6112 super(LsodarOSIType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6113 def exportLiteralChildren(self, outfile, level, name_): 6114 super(LsodarOSIType, self).exportLiteralChildren(outfile, level, name_) 6115 def build(self, node): 6116 already_processed = set() 6117 self.buildAttributes(node, node.attrib, already_processed) 6118 for child in node: 6119 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6120 self.buildChildren(child, node, nodeName_) 6121 return self 6122 def buildAttributes(self, node, attrs, already_processed): 6123 super(LsodarOSIType, self).buildAttributes(node, attrs, already_processed) 6124 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6125 super(LsodarOSIType, self).buildChildren(child_, node, nodeName_, True) 6126 pass 6127# end class LsodarOSIType 6128 6129 6130class OneStepNSProblems_ListType(GeneratedsSuper): 6131 subclass = None 6132 superclass = None 6133 def __init__(self, LCP=None, FrictionContact=None, QP=None, Relay=None): 6134 if LCP is None: 6135 self.LCP = [] 6136 else: 6137 self.LCP = LCP 6138 if FrictionContact is None: 6139 self.FrictionContact = [] 6140 else: 6141 self.FrictionContact = FrictionContact 6142 if QP is None: 6143 self.QP = [] 6144 else: 6145 self.QP = QP 6146 if Relay is None: 6147 self.Relay = [] 6148 else: 6149 self.Relay = Relay 6150 def factory(*args_, **kwargs_): 6151 if OneStepNSProblems_ListType.subclass: 6152 return OneStepNSProblems_ListType.subclass(*args_, **kwargs_) 6153 else: 6154 return OneStepNSProblems_ListType(*args_, **kwargs_) 6155 factory = staticmethod(factory) 6156 def get_LCP(self): return self.LCP 6157 def set_LCP(self, LCP): self.LCP = LCP 6158 def add_LCP(self, value): self.LCP.append(value) 6159 def insert_LCP(self, index, value): self.LCP[index] = value 6160 def get_FrictionContact(self): return self.FrictionContact 6161 def set_FrictionContact(self, FrictionContact): self.FrictionContact = FrictionContact 6162 def add_FrictionContact(self, value): self.FrictionContact.append(value) 6163 def insert_FrictionContact(self, index, value): self.FrictionContact[index] = value 6164 def get_QP(self): return self.QP 6165 def set_QP(self, QP): self.QP = QP 6166 def add_QP(self, value): self.QP.append(value) 6167 def insert_QP(self, index, value): self.QP[index] = value 6168 def get_Relay(self): return self.Relay 6169 def set_Relay(self, Relay): self.Relay = Relay 6170 def add_Relay(self, value): self.Relay.append(value) 6171 def insert_Relay(self, index, value): self.Relay[index] = value 6172 def hasContent_(self): 6173 if ( 6174 self.LCP or 6175 self.FrictionContact or 6176 self.QP or 6177 self.Relay 6178 ): 6179 return True 6180 else: 6181 return False 6182 def export(self, outfile, level, namespace_='', name_='OneStepNSProblems_ListType', namespacedef_='', pretty_print=True): 6183 if pretty_print: 6184 eol_ = '\n' 6185 else: 6186 eol_ = '' 6187 showIndent(outfile, level, pretty_print) 6188 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6189 already_processed = set() 6190 self.exportAttributes(outfile, level, already_processed, namespace_, name_='OneStepNSProblems_ListType') 6191 if self.hasContent_(): 6192 outfile.write('>%s' % (eol_, )) 6193 self.exportChildren(outfile, level + 1, namespace_='', name_='OneStepNSProblems_ListType', pretty_print=pretty_print) 6194 showIndent(outfile, level, pretty_print) 6195 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6196 else: 6197 outfile.write('/>%s' % (eol_, )) 6198 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OneStepNSProblems_ListType'): 6199 pass 6200 def exportChildren(self, outfile, level, namespace_='', name_='OneStepNSProblems_ListType', fromsubclass_=False, pretty_print=True): 6201 if pretty_print: 6202 eol_ = '\n' 6203 else: 6204 eol_ = '' 6205 for LCP_ in self.LCP: 6206 LCP_.export(outfile, level, namespace_, name_='LCP', pretty_print=pretty_print) 6207 for FrictionContact_ in self.FrictionContact: 6208 FrictionContact_.export(outfile, level, namespace_, name_='FrictionContact', pretty_print=pretty_print) 6209 for QP_ in self.QP: 6210 QP_.export(outfile, level, namespace_, name_='QP', pretty_print=pretty_print) 6211 for Relay_ in self.Relay: 6212 Relay_.export(outfile, level, namespace_, name_='Relay', pretty_print=pretty_print) 6213 def exportLiteral(self, outfile, level, name_='OneStepNSProblems_ListType'): 6214 level += 1 6215 already_processed = set() 6216 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6217 if self.hasContent_(): 6218 self.exportLiteralChildren(outfile, level, name_) 6219 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6220 pass 6221 def exportLiteralChildren(self, outfile, level, name_): 6222 showIndent(outfile, level) 6223 outfile.write('LCP=[\n') 6224 level += 1 6225 for LCP_ in self.LCP: 6226 showIndent(outfile, level) 6227 outfile.write('model_.LCPType(\n') 6228 LCP_.exportLiteral(outfile, level, name_='LCPType') 6229 showIndent(outfile, level) 6230 outfile.write('),\n') 6231 level -= 1 6232 showIndent(outfile, level) 6233 outfile.write('],\n') 6234 showIndent(outfile, level) 6235 outfile.write('FrictionContact=[\n') 6236 level += 1 6237 for FrictionContact_ in self.FrictionContact: 6238 showIndent(outfile, level) 6239 outfile.write('model_.FrictionContactType(\n') 6240 FrictionContact_.exportLiteral(outfile, level, name_='FrictionContactType') 6241 showIndent(outfile, level) 6242 outfile.write('),\n') 6243 level -= 1 6244 showIndent(outfile, level) 6245 outfile.write('],\n') 6246 showIndent(outfile, level) 6247 outfile.write('QP=[\n') 6248 level += 1 6249 for QP_ in self.QP: 6250 showIndent(outfile, level) 6251 outfile.write('model_.QPType(\n') 6252 QP_.exportLiteral(outfile, level, name_='QPType') 6253 showIndent(outfile, level) 6254 outfile.write('),\n') 6255 level -= 1 6256 showIndent(outfile, level) 6257 outfile.write('],\n') 6258 showIndent(outfile, level) 6259 outfile.write('Relay=[\n') 6260 level += 1 6261 for Relay_ in self.Relay: 6262 showIndent(outfile, level) 6263 outfile.write('model_.RelayType(\n') 6264 Relay_.exportLiteral(outfile, level, name_='RelayType') 6265 showIndent(outfile, level) 6266 outfile.write('),\n') 6267 level -= 1 6268 showIndent(outfile, level) 6269 outfile.write('],\n') 6270 def build(self, node): 6271 already_processed = set() 6272 self.buildAttributes(node, node.attrib, already_processed) 6273 for child in node: 6274 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6275 self.buildChildren(child, node, nodeName_) 6276 return self 6277 def buildAttributes(self, node, attrs, already_processed): 6278 pass 6279 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6280 if nodeName_ == 'LCP': 6281 obj_ = LCPType.factory() 6282 obj_.build(child_) 6283 self.LCP.append(obj_) 6284 elif nodeName_ == 'FrictionContact': 6285 obj_ = FrictionContactType.factory() 6286 obj_.build(child_) 6287 self.FrictionContact.append(obj_) 6288 elif nodeName_ == 'QP': 6289 obj_ = QPType.factory() 6290 obj_.build(child_) 6291 self.QP.append(obj_) 6292 elif nodeName_ == 'Relay': 6293 obj_ = RelayType.factory() 6294 obj_.build(child_) 6295 self.Relay.append(obj_) 6296# end class OneStepNSProblems_ListType 6297 6298 6299class LCPType(OSNSP): 6300 subclass = None 6301 superclass = OSNSP 6302 def __init__(self, StorageType=None, Id=None, NonSmoothSolver=None): 6303 super(LCPType, self).__init__(StorageType, Id, NonSmoothSolver, ) 6304 pass 6305 def factory(*args_, **kwargs_): 6306 if LCPType.subclass: 6307 return LCPType.subclass(*args_, **kwargs_) 6308 else: 6309 return LCPType(*args_, **kwargs_) 6310 factory = staticmethod(factory) 6311 def hasContent_(self): 6312 if ( 6313 super(LCPType, self).hasContent_() 6314 ): 6315 return True 6316 else: 6317 return False 6318 def export(self, outfile, level, namespace_='', name_='LCPType', namespacedef_='', pretty_print=True): 6319 if pretty_print: 6320 eol_ = '\n' 6321 else: 6322 eol_ = '' 6323 showIndent(outfile, level, pretty_print) 6324 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6325 already_processed = set() 6326 self.exportAttributes(outfile, level, already_processed, namespace_, name_='LCPType') 6327 if self.hasContent_(): 6328 outfile.write('>%s' % (eol_, )) 6329 self.exportChildren(outfile, level + 1, namespace_='', name_='LCPType', pretty_print=pretty_print) 6330 showIndent(outfile, level, pretty_print) 6331 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6332 else: 6333 outfile.write('/>%s' % (eol_, )) 6334 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LCPType'): 6335 super(LCPType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LCPType') 6336 def exportChildren(self, outfile, level, namespace_='', name_='LCPType', fromsubclass_=False, pretty_print=True): 6337 super(LCPType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6338 def exportLiteral(self, outfile, level, name_='LCPType'): 6339 level += 1 6340 already_processed = set() 6341 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6342 if self.hasContent_(): 6343 self.exportLiteralChildren(outfile, level, name_) 6344 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6345 super(LCPType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6346 def exportLiteralChildren(self, outfile, level, name_): 6347 super(LCPType, self).exportLiteralChildren(outfile, level, name_) 6348 def build(self, node): 6349 already_processed = set() 6350 self.buildAttributes(node, node.attrib, already_processed) 6351 for child in node: 6352 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6353 self.buildChildren(child, node, nodeName_) 6354 return self 6355 def buildAttributes(self, node, attrs, already_processed): 6356 super(LCPType, self).buildAttributes(node, attrs, already_processed) 6357 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6358 super(LCPType, self).buildChildren(child_, node, nodeName_, True) 6359 pass 6360# end class LCPType 6361 6362 6363class FrictionContactType(OSNSP): 6364 subclass = None 6365 superclass = OSNSP 6366 def __init__(self, StorageType=None, Id=None, NonSmoothSolver=None, Type=None): 6367 super(FrictionContactType, self).__init__(StorageType, Id, NonSmoothSolver, ) 6368 self.Type = _cast(int, Type) 6369 pass 6370 def factory(*args_, **kwargs_): 6371 if FrictionContactType.subclass: 6372 return FrictionContactType.subclass(*args_, **kwargs_) 6373 else: 6374 return FrictionContactType(*args_, **kwargs_) 6375 factory = staticmethod(factory) 6376 def get_Type(self): return self.Type 6377 def set_Type(self, Type): self.Type = Type 6378 def hasContent_(self): 6379 if ( 6380 super(FrictionContactType, self).hasContent_() 6381 ): 6382 return True 6383 else: 6384 return False 6385 def export(self, outfile, level, namespace_='', name_='FrictionContactType', namespacedef_='', pretty_print=True): 6386 if pretty_print: 6387 eol_ = '\n' 6388 else: 6389 eol_ = '' 6390 showIndent(outfile, level, pretty_print) 6391 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6392 already_processed = set() 6393 self.exportAttributes(outfile, level, already_processed, namespace_, name_='FrictionContactType') 6394 if self.hasContent_(): 6395 outfile.write('>%s' % (eol_, )) 6396 self.exportChildren(outfile, level + 1, namespace_='', name_='FrictionContactType', pretty_print=pretty_print) 6397 showIndent(outfile, level, pretty_print) 6398 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6399 else: 6400 outfile.write('/>%s' % (eol_, )) 6401 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FrictionContactType'): 6402 super(FrictionContactType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FrictionContactType') 6403 if self.Type is not None and 'Type' not in already_processed: 6404 already_processed.add('Type') 6405 outfile.write(' Type="%s"' % self.gds_format_integer(self.Type, input_name='Type')) 6406 def exportChildren(self, outfile, level, namespace_='', name_='FrictionContactType', fromsubclass_=False, pretty_print=True): 6407 super(FrictionContactType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6408 def exportLiteral(self, outfile, level, name_='FrictionContactType'): 6409 level += 1 6410 already_processed = set() 6411 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6412 if self.hasContent_(): 6413 self.exportLiteralChildren(outfile, level, name_) 6414 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6415 if self.Type is not None and 'Type' not in already_processed: 6416 already_processed.add('Type') 6417 showIndent(outfile, level) 6418 outfile.write('Type=%d,\n' % (self.Type,)) 6419 super(FrictionContactType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6420 def exportLiteralChildren(self, outfile, level, name_): 6421 super(FrictionContactType, self).exportLiteralChildren(outfile, level, name_) 6422 def build(self, node): 6423 already_processed = set() 6424 self.buildAttributes(node, node.attrib, already_processed) 6425 for child in node: 6426 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6427 self.buildChildren(child, node, nodeName_) 6428 return self 6429 def buildAttributes(self, node, attrs, already_processed): 6430 value = find_attr_value_('Type', node) 6431 if value is not None and 'Type' not in already_processed: 6432 already_processed.add('Type') 6433 try: 6434 self.Type = int(value) 6435 except ValueError as exp: 6436 raise_parse_error(node, 'Bad integer attribute: %s' % exp) 6437 if self.Type <= 0: 6438 raise_parse_error(node, 'Invalid PositiveInteger') 6439 super(FrictionContactType, self).buildAttributes(node, attrs, already_processed) 6440 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6441 super(FrictionContactType, self).buildChildren(child_, node, nodeName_, True) 6442 pass 6443# end class FrictionContactType 6444 6445 6446class QPType(OSNSP): 6447 subclass = None 6448 superclass = OSNSP 6449 def __init__(self, StorageType=None, Id=None, NonSmoothSolver=None, Q=None, p=None): 6450 super(QPType, self).__init__(StorageType, Id, NonSmoothSolver, ) 6451 self.Q = Q 6452 self.p = p 6453 def factory(*args_, **kwargs_): 6454 if QPType.subclass: 6455 return QPType.subclass(*args_, **kwargs_) 6456 else: 6457 return QPType(*args_, **kwargs_) 6458 factory = staticmethod(factory) 6459 def get_Q(self): return self.Q 6460 def set_Q(self, Q): self.Q = Q 6461 def get_p(self): return self.p 6462 def set_p(self, p): self.p = p 6463 def hasContent_(self): 6464 if ( 6465 self.Q is not None or 6466 self.p is not None or 6467 super(QPType, self).hasContent_() 6468 ): 6469 return True 6470 else: 6471 return False 6472 def export(self, outfile, level, namespace_='', name_='QPType', namespacedef_='', pretty_print=True): 6473 if pretty_print: 6474 eol_ = '\n' 6475 else: 6476 eol_ = '' 6477 showIndent(outfile, level, pretty_print) 6478 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6479 already_processed = set() 6480 self.exportAttributes(outfile, level, already_processed, namespace_, name_='QPType') 6481 if self.hasContent_(): 6482 outfile.write('>%s' % (eol_, )) 6483 self.exportChildren(outfile, level + 1, namespace_='', name_='QPType', pretty_print=pretty_print) 6484 showIndent(outfile, level, pretty_print) 6485 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6486 else: 6487 outfile.write('/>%s' % (eol_, )) 6488 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='QPType'): 6489 super(QPType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='QPType') 6490 def exportChildren(self, outfile, level, namespace_='', name_='QPType', fromsubclass_=False, pretty_print=True): 6491 super(QPType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6492 if pretty_print: 6493 eol_ = '\n' 6494 else: 6495 eol_ = '' 6496 if self.Q is not None: 6497 self.Q.export(outfile, level, namespace_, name_='Q', pretty_print=pretty_print) 6498 if self.p is not None: 6499 self.p.export(outfile, level, namespace_, name_='p', pretty_print=pretty_print) 6500 def exportLiteral(self, outfile, level, name_='QPType'): 6501 level += 1 6502 already_processed = set() 6503 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6504 if self.hasContent_(): 6505 self.exportLiteralChildren(outfile, level, name_) 6506 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6507 super(QPType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6508 def exportLiteralChildren(self, outfile, level, name_): 6509 super(QPType, self).exportLiteralChildren(outfile, level, name_) 6510 if self.Q is not None: 6511 showIndent(outfile, level) 6512 outfile.write('Q=model_.matrix(\n') 6513 self.Q.exportLiteral(outfile, level, name_='Q') 6514 showIndent(outfile, level) 6515 outfile.write('),\n') 6516 if self.p is not None: 6517 showIndent(outfile, level) 6518 outfile.write('p=model_.vector(\n') 6519 self.p.exportLiteral(outfile, level, name_='p') 6520 showIndent(outfile, level) 6521 outfile.write('),\n') 6522 def build(self, node): 6523 already_processed = set() 6524 self.buildAttributes(node, node.attrib, already_processed) 6525 for child in node: 6526 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6527 self.buildChildren(child, node, nodeName_) 6528 return self 6529 def buildAttributes(self, node, attrs, already_processed): 6530 super(QPType, self).buildAttributes(node, attrs, already_processed) 6531 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6532 if nodeName_ == 'Q': 6533 obj_ = matrix.factory() 6534 obj_.build(child_) 6535 self.Q = obj_ 6536 elif nodeName_ == 'p': 6537 obj_ = vector.factory() 6538 obj_.build(child_) 6539 self.p = obj_ 6540 super(QPType, self).buildChildren(child_, node, nodeName_, True) 6541# end class QPType 6542 6543 6544class RelayType(OSNSP): 6545 subclass = None 6546 superclass = OSNSP 6547 def __init__(self, StorageType=None, Id=None, NonSmoothSolver=None, M=None, q=None): 6548 super(RelayType, self).__init__(StorageType, Id, NonSmoothSolver, ) 6549 self.M = M 6550 self.q = q 6551 def factory(*args_, **kwargs_): 6552 if RelayType.subclass: 6553 return RelayType.subclass(*args_, **kwargs_) 6554 else: 6555 return RelayType(*args_, **kwargs_) 6556 factory = staticmethod(factory) 6557 def get_M(self): return self.M 6558 def set_M(self, M): self.M = M 6559 def get_q(self): return self.q 6560 def set_q(self, q): self.q = q 6561 def hasContent_(self): 6562 if ( 6563 self.M is not None or 6564 self.q is not None or 6565 super(RelayType, self).hasContent_() 6566 ): 6567 return True 6568 else: 6569 return False 6570 def export(self, outfile, level, namespace_='', name_='RelayType', namespacedef_='', pretty_print=True): 6571 if pretty_print: 6572 eol_ = '\n' 6573 else: 6574 eol_ = '' 6575 showIndent(outfile, level, pretty_print) 6576 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) 6577 already_processed = set() 6578 self.exportAttributes(outfile, level, already_processed, namespace_, name_='RelayType') 6579 if self.hasContent_(): 6580 outfile.write('>%s' % (eol_, )) 6581 self.exportChildren(outfile, level + 1, namespace_='', name_='RelayType', pretty_print=pretty_print) 6582 showIndent(outfile, level, pretty_print) 6583 outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) 6584 else: 6585 outfile.write('/>%s' % (eol_, )) 6586 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RelayType'): 6587 super(RelayType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RelayType') 6588 def exportChildren(self, outfile, level, namespace_='', name_='RelayType', fromsubclass_=False, pretty_print=True): 6589 super(RelayType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) 6590 if pretty_print: 6591 eol_ = '\n' 6592 else: 6593 eol_ = '' 6594 if self.M is not None: 6595 self.M.export(outfile, level, namespace_, name_='M', pretty_print=pretty_print) 6596 if self.q is not None: 6597 self.q.export(outfile, level, namespace_, name_='q', pretty_print=pretty_print) 6598 def exportLiteral(self, outfile, level, name_='RelayType'): 6599 level += 1 6600 already_processed = set() 6601 self.exportLiteralAttributes(outfile, level, already_processed, name_) 6602 if self.hasContent_(): 6603 self.exportLiteralChildren(outfile, level, name_) 6604 def exportLiteralAttributes(self, outfile, level, already_processed, name_): 6605 super(RelayType, self).exportLiteralAttributes(outfile, level, already_processed, name_) 6606 def exportLiteralChildren(self, outfile, level, name_): 6607 super(RelayType, self).exportLiteralChildren(outfile, level, name_) 6608 if self.M is not None: 6609 showIndent(outfile, level) 6610 outfile.write('M=model_.matrix(\n') 6611 self.M.exportLiteral(outfile, level, name_='M') 6612 showIndent(outfile, level) 6613 outfile.write('),\n') 6614 if self.q is not None: 6615 showIndent(outfile, level) 6616 outfile.write('q=model_.vector(\n') 6617 self.q.exportLiteral(outfile, level, name_='q') 6618 showIndent(outfile, level) 6619 outfile.write('),\n') 6620 def build(self, node): 6621 already_processed = set() 6622 self.buildAttributes(node, node.attrib, already_processed) 6623 for child in node: 6624 nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] 6625 self.buildChildren(child, node, nodeName_) 6626 return self 6627 def buildAttributes(self, node, attrs, already_processed): 6628 super(RelayType, self).buildAttributes(node, attrs, already_processed) 6629 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 6630 if nodeName_ == 'M': 6631 obj_ = matrix.factory() 6632 obj_.build(child_) 6633 self.M = obj_ 6634 elif nodeName_ == 'q': 6635 obj_ = vector.factory() 6636 obj_.build(child_) 6637 self.q = obj_ 6638 super(RelayType, self).buildChildren(child_, node, nodeName_, True) 6639# end class RelayType 6640 6641 6642GDSClassesMapping = { 6643 'QP': QPType, 6644 'indexList': vector, 6645 'Velocity0': vector, 6646 'MoreauJeanOSI': MoreauJeanOSIType, 6647 'FirstOrderLinearR': FirstOrderLinearRType, 6648 'NewtonImpactNSL': NewtonImpactNSLType, 6649 'iparam': vector, 6650 'LsodarOSI': LsodarOSIType, 6651 'FGyr': vector, 6652 'Interaction': InteractionType, 6653 'LagrangianRheonomousR': LagrangianRheonomousRType, 6654 'LagrangianLinearTIDS': LagrangianLinearTIDSType, 6655 'OneStepIntegrator_LMGC90': OneStepIntegrator_LMGC90Type, 6656 'Theta': emptyType, 6657 'NSDS': NSDSType, 6658 'JacobianDothq': pluginDef, 6659 'Jacobianhq': pluginDef, 6660 'ComplementarityConditionNSL': ComplementarityConditionNSLType, 6661 'D': matrix, 6662 'FirstOrderLinearDS': FirstOrderLinearDSType, 6663 'q0': vector, 6664 'FirstOrderLinearTIDS': FirstOrderLinearTIDSType, 6665 'Linear': LinearType, 6666 'FirstOrderNonLinearDS': FirstOrderNonLinearDSType, 6667 'NewtonImpactFrictionNSL': NewtonImpactFrictionNSLType, 6668 'F': matrix, 6669 'JacobianDoth': pluginDef, 6670 'Omega0': matrix, 6671 'jacobianG': listOfMatrices, 6672 'Q': matrix, 6673 'tk': vector, 6674 'RelayNSL': RelayNSLType, 6675 'DS_Definition': DS_DefinitionType, 6676 'OmegaT': matrix, 6677 'OneStepIntegrator_Definition': OneStepIntegrator_DefinitionType, 6678 'Omega': vector, 6679 'LagrangianCompliantR': LagrangianCompliantRType, 6680 'A': matrix, 6681 'C': matrix, 6682 'Jacobianfx': matrix, 6683 'FrictionContact': FrictionContactType, 6684 'Interaction_Content': Interaction_ContentType, 6685 'Interaction_Definition': Interaction_DefinitionType, 6686 'FExt': vector, 6687 'Jacobianhlambda': pluginDef, 6688 'FirstOrderLinearTIR': FirstOrderLinearTIRType, 6689 'K': matrix, 6690 'M': matrix, 6691 'FInt': vector, 6692 'Simulation': SimulationType, 6693 'JacobianQFInt': matrix, 6694 'LagrangianScleronomousR': LagrangianScleronomousRType, 6695 'Periodic': PeriodicType, 6696 'Mass': matrix, 6697 'NLinear': NLinearType, 6698 'Time': ModelTime, 6699 'dparam': vector, 6700 'x0': vector, 6701 'DS_LMGC90': DS_LMGC90Type, 6702 'OneStepNSProblems_List': OneStepNSProblems_ListType, 6703 'LagrangianDS': LagrangianDSType, 6704 'Relay': RelayType, 6705 'JacobianQFGyr': matrix, 6706 'b': vector, 6707 'e': vector, 6708 'LCP': LCPType, 6709 'g': pluginDef, 6710 'f': vector, 6711 'h': pluginDef, 6712 'TimeDiscretisation': TimeDiscretisationType, 6713 'q': vector, 6714 'p': vector, 6715 'jacobianH': listOfMatrices, 6716 'LagrangianLinearTIR': LagrangianLinearTIRType, 6717 'FirstOrderR': FirstOrderRType, 6718 'B': matrix, 6719 'JacobianVelocityFInt': matrix, 6720 'JacobianVelocityFGyr': matrix, 6721} 6722 6723 6724USAGE_TEXT = """ 6725Usage: python <Parser>.py [ -s ] <in_xml_file> 6726""" 6727 6728 6729def usage(): 6730 print(USAGE_TEXT) 6731 sys.exit(1) 6732 6733 6734def get_root_tag(node): 6735 tag = Tag_pattern_.match(node.tag).groups()[-1] 6736 rootClass = GDSClassesMapping.get(tag) 6737 if rootClass is None: 6738 rootClass = globals().get(tag) 6739 return tag, rootClass 6740 6741 6742def parse(inFileName, silence=False): 6743 doc = parsexml_(inFileName) 6744 rootNode = doc.getroot() 6745 rootTag, rootClass = get_root_tag(rootNode) 6746 if rootClass is None: 6747 rootTag = 'pluginDef' 6748 rootClass = pluginDef 6749 rootObj = rootClass.factory() 6750 rootObj.build(rootNode) 6751 # Enable Python to collect the space used by the DOM. 6752 doc = None 6753 if not silence: 6754 sys.stdout.write('<?xml version="1.0" ?>\n') 6755 rootObj.export( 6756 sys.stdout, 0, name_=rootTag, 6757 namespacedef_='', 6758 pretty_print=True) 6759 return rootObj 6760 6761 6762def parseEtree(inFileName, silence=False): 6763 doc = parsexml_(inFileName) 6764 rootNode = doc.getroot() 6765 rootTag, rootClass = get_root_tag(rootNode) 6766 if rootClass is None: 6767 rootTag = 'pluginDef' 6768 rootClass = pluginDef 6769 rootObj = rootClass.factory() 6770 rootObj.build(rootNode) 6771 # Enable Python to collect the space used by the DOM. 6772 doc = None 6773 mapping = {} 6774 rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) 6775 reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) 6776 if not silence: 6777 content = etree_.tostring( 6778 rootElement, pretty_print=True, 6779 xml_declaration=True, encoding="utf-8") 6780 sys.stdout.write(content) 6781 sys.stdout.write('\n') 6782 return rootObj, rootElement, mapping, reverse_mapping 6783 6784 6785def parseString(inString, silence=False): 6786 from io import StringIO 6787 doc = parsexml_(StringIO(inString)) 6788 rootNode = doc.getroot() 6789 roots = get_root_tag(rootNode) 6790 rootClass = roots[1] 6791 if rootClass is None: 6792 rootClass = pluginDef 6793 rootObj = rootClass.factory() 6794 rootObj.build(rootNode) 6795 # Enable Python to collect the space used by the DOM. 6796 doc = None 6797 if not silence: 6798 sys.stdout.write('<?xml version="1.0" ?>\n') 6799 rootObj.export( 6800 sys.stdout, 0, name_="pluginDef", 6801 namespacedef_='') 6802 return rootObj 6803 6804 6805def parseLiteral(inFileName, silence=False): 6806 doc = parsexml_(inFileName) 6807 rootNode = doc.getroot() 6808 rootTag, rootClass = get_root_tag(rootNode) 6809 if rootClass is None: 6810 rootTag = 'pluginDef' 6811 rootClass = pluginDef 6812 rootObj = rootClass.factory() 6813 rootObj.build(rootNode) 6814 # Enable Python to collect the space used by the DOM. 6815 doc = None 6816 if not silence: 6817 sys.stdout.write('#from SiconosXMLParser import *\n\n') 6818 sys.stdout.write('import SiconosXMLParser as model_\n\n') 6819 sys.stdout.write('rootObj = model_.rootTag(\n') 6820 rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) 6821 sys.stdout.write(')\n') 6822 return rootObj 6823 6824 6825def main(): 6826 args = sys.argv[1:] 6827 if len(args) == 1: 6828 parse(args[0]) 6829 else: 6830 usage() 6831 6832 6833if __name__ == '__main__': 6834 #import pdb; pdb.set_trace() 6835 main() 6836 6837 6838__all__ = [ 6839 "BoundaryCondition", 6840 "ComplementarityConditionNSLType", 6841 "DS_DefinitionType", 6842 "DS_LMGC90Type", 6843 "FirstOrderLinearDSType", 6844 "FirstOrderLinearRType", 6845 "FirstOrderLinearTIDSType", 6846 "FirstOrderLinearTIRType", 6847 "FirstOrderNonLinearDSType", 6848 "FirstOrderRType", 6849 "FrictionContactType", 6850 "InteractionType", 6851 "Interaction_ContentType", 6852 "Interaction_DefinitionType", 6853 "LCPType", 6854 "LagrangianCompliantRType", 6855 "LagrangianDSType", 6856 "LagrangianLinearTIDSType", 6857 "LagrangianLinearTIRType", 6858 "LagrangianRheonomousRType", 6859 "LagrangianScleronomousRType", 6860 "LinearType", 6861 "LsodarOSIType", 6862 "ModelTime", 6863 "MoreauJeanOSIType", 6864 "NLinearType", 6865 "NSDSType", 6866 "NSL", 6867 "NewtonImpactFrictionNSLType", 6868 "NewtonImpactNSLType", 6869 "NonSmoothSolver", 6870 "OSI", 6871 "OSNSP", 6872 "OneStepIntegrator_DefinitionType", 6873 "OneStepIntegrator_LMGC90Type", 6874 "OneStepNSProblems_ListType", 6875 "PeriodicType", 6876 "QPType", 6877 "RelayNSLType", 6878 "RelayType", 6879 "SiconosModel", 6880 "SimulationType", 6881 "TimeDiscretisationType", 6882 "emptyType", 6883 "index_list", 6884 "listOfMatrices", 6885 "matrix", 6886 "matrixData", 6887 "matrixFile", 6888 "matrixPlugin", 6889 "pluginDef", 6890 "vector" 6891] 6892