msc.nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 applications the toolkit...

342
MSC.Nastran 2001 Toolkit User’s Guide March 2003

Upload: ngoduong

Post on 20-Apr-2018

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran 2001

ToolkitUser’s Guide

March 2003

Page 2: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

CorporateMSC.Software Corporation2 MacArthur PlaceSanta Ana, CA 92707 USATelephone: (800) 345-2078Fax: (714) 784-4056

EuropeMSC.Software GmbHAm Moosfeld 1381829 Munich, GermanyTelephone: (49) (89) 43 19 87 0Fax: (49) (89) 43 61 71 6

Asia PacificMSC.Software Japan Ltd.Entsuji-Gadelius Building2-39, Akasaka 5-chomeMinato-ku, Tokyo 107-0052, JapanTelephone: (81) (3) 3505 0266Fax: (81) (3) 3505 0914

Worldwide Webwww.mscsoftware.com

Disclaimer

MSC.Software Corporation reserves the right to make changes in specifications and other information contained in this document without prior notice.

The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem or design. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein.

User Documentation: Copyright 2003 MSC.Software Corporation. Printed in U.S.A. All Rights Reserved.

This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without the prior written consent of MSC.Software Corporation is prohibited.

MSC, the MSC.Software logo, Simulating Reality, and Patran are registered trademarks of the MSC.Software Corporation in the United States and/or other countries. MSC., MSC.Dytran, MSC.Marc, MSC.Laminate Modeler, MSC.Nastran, MSC.visualNastran, and MSC.Patran are trademarks of MSC.Software Corporation.

NASTRAN is a registered trademark of NASA. PAMCRASH is a trademark or registered trademark of ESI Group. SAMCEF is a trademark or registered trademark of Samtech SA. LS-DYNA is a trademark or registered trademark of Livermore Software Technology Corporation. ANSYS is a registered trademark of SAS IP, Inc., a wholly owned subsidiary of ANSYS Inc. ABAQUS is a registered trademark of ABAQUS Inc. All other brand names, product names or trademarks belong to their respective owners.

NATK*V2001*Z*Z*Z*DC-USR

Page 3: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

C O N T E N T SMSC.Nastran Toolkit User’s Guide

Preface ■ About this Book, vi❑ Overview, vi

1Introduction ■ Features, 2

■ Applications, 4

■ Delivery Contents, 6

2Using the MSC.Nastran Toolkit

■ Frequently Asked Questions, 8

■ References, 13

■ API Syntax, 14

3Executive System APIs

■ Starting the MSC.Nastran Server, 18

■ Stopping the MSC.Nastran Server, 19

■ Setting DMAP Breakpoints, 20

■ Submitting Additional MSC.Nastran Input Files, 21

■ Executing Individual DMAP Modules, 22

■ Setting Client and Server Timeout Limits, 23

■ Executive APIs, 24

4Database Features and APIs

■ Retrieving Data From a Database, 70

■ Writing Data to a Database, 73

■ Database Utilities, 75

Page 4: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

5File I/O APIs ■ GINO, 124

■ General I/O Utilities, 127

6Table I/O APIs ■ Table APIs, 146

7Matrix I/O APIs ■ Matrix APIs, 162

8Direct Access I/O APIs

■ Grid Direct Access API's, 184

■ Element Connectivity and Property Recovery API (IFP API's), 191

■ Summary of How to Use the IFP API's, 193

■ Data Recovery API's (OFP Type Datablocks), 199

A MSC.Nastran Datablocks Tutorial

■ Datablock Information, 246❑ Datablock Basics, 246❑ Datablock Structure and Composition, 246❑ Datablock Pseudonyms, 247❑ Textural Descriptions, 247❑ Inter-version Changes, 248❑ Helpful Hints, 248

■ Output Style Blocks, 251

■ Approach Codes, 254

■ Stress Codes, 255

■ Did a Block Change?, 257

■ TABPRT, 258

■ SEDRCVR, 259

■ DBLOCATE and Print, 261

Page 5: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

BMSC.Nastran Database Features

CJava Language Bindings

■ This Appendix Contains the Java Interface descriptions for the MSC.Nastran Toolkit API., 268

■ Java API’s, 269

DList of API Error Codes

EToolkit Compile and Link Instructions

■ Makefiles, 304- Example makefile for AIX, 304

FUtility Functions ❑ GetArgument, 308

❑ OpenLogFile, 308❑ PrintMessage, 308

GExample Toolkit Client Applications

■ Toolkit Code Librarian, 312

HOFP Subindex Description

■ OFP Subindex Description, 314

INDEX ■ MSC.Nastran Toolkit User’s Guide, 317Sales and Support ■ List of MSC.Nastran Books, 324

■ Technical Support, 325

Page 6: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

■ Internet Resources, 328

■ Permission to Copy and Distribute MSC Documentation, 329

Page 7: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

Preface

■ About this Book

Page 8: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

vi

About this BookThe MSC.Nastran Toolkit User's Guide describes the function of each Toolkit Application Programming Interface (API).

OverviewThe MSC.Nastran Toolkit provides the necessary tools (Application Programming Interfaces) to write customized stand-alone applications that can communicate with the MSC.Nastran program using client-server technology. The Toolkit provides the mechanism to create stand-alone applications that can access all of MSC.Nastran's functionality/components (i.e., matrix operations, utilities, engineering (FE) functions, and database management system) and incorporate these into a modern software framework. This framework facilitates multi-tier architectures, Web-enabled applications, and the distribution of MSC.Nastran's functionality across different host computers.

MSC.NastranExecutable

MSC.NastranDMAP Library

A P

I

Dat

abas

e

A P

I

User-WrittenClient Program

MSC-SuppliedClient ObjectLibrary

Page 9: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

CHAPTER

1 Introduction

■ Features

■ Applications

■ Delivery Contents

Page 10: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

2

1.1 FeaturesThe MSC.Nastran Toolkit provides the following capabilities.

• Programmatic interface to MSC.Nastran using client-server technology.

• The ability to invoke any MSC.Nastran Module using standard DMAP and/or MSC.Nastran Solution Sequences.

• Full access to the MSC.Nastran database (e.g., queries, datablock creation, including read/write/pack/unpack access for both MSC.Nastran tables and matrices).

• C, FORTRAN and Java language bindings.

• A single MSC.Nastran executable that can be invoked by either the traditional batch method (i.e., command line invocation) or by the new client-server connection.

• The ability to link client created programs and the Toolkit.

• Communication between a single client program and multiple MSC.Nastran analysis runs and their databases.

• The ability to communicate across heterogeneous (nonbinary compatible) platforms.

• Full client-side access to MSC.Nastran error messages.

• Element/grid level direct (keyed) access to databooks (e.g., property data, connectivity data, stress, strain, force, displacements, etc.).

• A select API, used to specify a subset of data (e.g., select (ekey, sx1 ) where (ekey=10 and sx1<1.0E03) relation( record=‘quad4’)).

• A specialized client-server API that allows client-server communication and data transfer at any point within a DMAP Solution Sequence (comparable to an interactive language debugger).

Based on the above features, the Toolkit can now serve as a replacement or better alternative for prior MSC.Nastran data access methods, such as xdb, Input2/Output4, the ISHELL module, and even User-Modifiable MSC.Nastran.

Page 11: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

3CHAPTER 1Introduction

Figure 1-1 MSC.Nastran Toolkit Interfaces

MSC.Nastran

1. Input Data

2. DMAP - Level Communication

3. Direct Database Access(e.g., read/write/update, dynamic datablockcreation, query database schema API’s,sequential I/O or direct access I/O usingindexes, automatic binary-to-neutral I/Oconversions using XDR functions)

Exec Control

User DMAP

Bulk Data

Toolkit(Communicates at 3 Levels)

DMAP

Database

Page 12: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

4

1.2 ApplicationsThe Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads and MSC.Ultima. It has changed the way new products are being designed within MSC.Software by providing developers with new robust development tools that provide direct client-server access to MSC.Nastran.

The Toolkit makes it possible to construct client applications that perform calculation-on-the-fly. This is possible through the Toolkit’s ability to interact with MSC.Nastran at both the input file level as well as the database/executive system level. Multiple input files (bdf’s) and their associated DMAP sequences can be submitted interactively during one client session with the resultant module output (datablocks) being immediately accessible for reading by the client application. In addition, a Toolkit-enabled client program can interact with multiple servers (MSC.Nastran) that can reside on the same or different machines.

Typical Usage Scenario (3-tier

CORBA/RMI or others..

MSC.Patran W eb Interface Or Others…

ToolkitToolkit

Interfaces (W rappers)

MSC.N astran

Tier-3

MSC’s Middleware (pipes,sockets-rsh…)

Typical Usage Scenario (3-tier Architecture)

Page 13: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

5CHAPTER 1Introduction

A single Toolkit client program controlling multiple servers/machines with each server receiving multiple input files (bdf’s)

Figure 1-2 Example of “On-the-fly” Data Recovery

User-WrittenClient Program

Begin loop:...Send BDF withnew Case Controlelement stressrequests...Loop back:

AP

I

AP

IA

PI

AP

I

Case ControlFMSDMAP

Case ControlFMSDMAP

Case ControlFMSDMAP

SET+....DBLOCATEIFP1SDR2

SET+....DBLOCATEIFP1SDR2

SET+....DBLOCATEIFP1SDR2

Toolkit Client Program

MSC.Nastran Servers

TCP/IPprotocol

(pipes/sockets)

BDF

BDF

BDF

Stress data

Stress data

Stress data

Page 14: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

6

1.3 Delivery ContentsThe following items are included in the delivery content of the MSC.Nastran Toolkit.

• libclient

The client object library containing the MSC.Nastran Toolkit API's defined in this document and the associated Inter Process Communication (IPC) middleware that provides the client-server connection to the MSC.Nastran program.

• Toolkit.jar, toolkitjava

Java package containing java source and classes necessary to build java applications.

• makefile

The makefile for compiling/linking client applications. Examples of Toolkit makefiles for various platforms is listed in Toolkit Compile and Link Instructions (App. E). See also Note 1 below.

• Example client programs

Example client programs that demonstrate the use of the various MSC.Nastran Toolkit API's. (See Note 2 below.)

Notes: 1. As part of a Toolkit training class offered by MSC.Software students are taught how to build Toolkit client programs using various build environments. For more details on the MSC.Nastran Toolkit Training Class contact MSC.Software.

2. The Toolkit Code Librarian (a Toolkit code-example help system) described in Chapter 2, Section 2.3 is included as part of the MSC.Nastran Toolkit delivery.

3. In addition to the above Toolkit related components the standard MSC.Nastran system must be available for access by the Toolkit client program.

Page 15: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

CHAPTER

2 Using the MSC.Nastran Toolkit

■ Frequently Asked Questions

■ References

■ API Syntax

Page 16: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

8

2.1 Frequently Asked Questions

Is it difficult to write applications with the Toolkit?

It depends on what you are trying to accomplish, but basically there are three ways to compare the difficulty of using the Toolkit:

• The first is to liken it to writing new modules within MSC.Nastran (i.e., for certain Toolkit applications you will need to understand MSC.Nastran in order to write your code since you will be utilizing DMAP modules, datablocks, and the MSC.Nastran database).

• The second, preferred way, is to take advantage of our plan to develop libraries of reusable Toolkit components that become available to every Toolkit developer—this library of reusable components would be analogous to MSC.Nastran's DMAP solution sequences.

Note that the Toolkit Code librarian Help System discussed earlier is one example of providing reusable components.

• And finally, another perspective on the issue of relative complexity is that there are applications you could not develop before the Toolkit became available (e.g., Web-based interactive data recovery applications that require JAVA or some other Web-based interface that employs the latest distributed component technology).

What’s the history of the Toolkit?

The development of MSC.Nastran’s Client-Server Technology began in 1992:

• 1992 - INAST68 Interactive Database Debugging Tool (an initial demonstration of a client-server connection to MSC.Nastran).

Followed by:

• External Geometry Evaluator, which used an expanded and enhanced version of the prior debugging tool.

• The External Beam Library.

• The NIF-reader, which uses a variation of the present Toolkit technology for the Patran-Nastran client-server bulk data reader.

• 1997 - Current general purpose Toolkit developed.

Does the Toolkit use CORBA?

Not directly. However, the typical three-tier architecture diagram at the beginning of this guide shows how CORBA, COM, RMI or any other distributed object technology can be utilized within the current Toolkit architecture. In fact, MSC.Nastran's Java-based Toolkit Data Browser Application demonstrates this capability by being RMI-enabled.

Page 17: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

9CHAPTER 2Using the MSC.Nastran Toolkit

How does the Toolkit compare with MSC.Nastran’s various data access mechanisms?

(NASTPAT3, the NIF-Reader, MSC.Patran’s Direct Results Access that uses .xdb files, Input2/Output4, the ISHELL module and User-Modifiable MSC.Nastran)

This is perhaps one of the most important questions about the Toolkit. The short answer is that the Toolkit can now serve as a replacement or better alternative for all these mechanisms. The reason why this is so important is because we now have a tool that can reduce the proliferation of these various data access mechanisms and their high-support costs. Note that the support/maintenance costs are high, not due to deficiencies in the design of these programs, but rather because of the inherent complexity of the data they are required to process.

To better understand the goal of using the Toolkit to replace these mechanisms here is a brief description of each of them in relationship to the Toolkit:

• NASTPAT3

Description: Reads MSC.Nastran data (via Output2 files) and then maps this into the MSC.Patran database.

Toolkit Usage: The Toolkit replaces the need for duplication of data through intermediate Output2 files—with the Toolkit, the same data can be read directly from the MSC.Nastran database.

• NIF-Reader

Description: Uses a "pre-Toolkit" client-server mechanism to allow MSC.Patran to submit bulk data files to MSC.Nastran for processing. The resultant processed and verified "input file" is then read back into MSC.Patran from the MSC.Nastran database.

Toolkit Usage: This represents an example of older "pre-Toolkit" technology that can now be replaced with the MSC.Nastran Toolkit and its efficient, standardized, and "easier-to-use" mechanism for directly accessing the MSC.Nastran database.

• MSC.Patran’s DRA (that uses .xdb files)

Description: Currently the DRA accesses .xdb files created by a special module within MSC.Nastran. These files are created by converting existing MSC.Nastran datablocks into special direct access files (.xdb files).

Toolkit Usage: The DRA data access engine can now be replaced with an approach that provides the benefit of direct MSC.Nastran database access, the elimination of duplicate data (i.e., no xdb files), and the elimination of additional maintenance support for the database management system that supports the .xdb file format.

• Output2/Output4 files

Description: An unformatted or formatted file (sequential access only) that provides a FORTRAN readable copy of data on the MSC.Nastran database.

Page 18: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

10

Toolkit Usage: The Toolkit provides an obvious alternative to these FORTRAN files by allowing direct access to the same data, without copies, using the MSC.Nastran database. It has the additional advantage of retaining the database qualification (keys) associated with the data.

• ISHELL module

Description: ISHELL allows execution of an external program from within the MSC.Nastran environment. MSC.Nastran remains in a wait state until the external program has completed. Note that unlike the Toolkit, the external program started by the ISHELL module cannot access the MSC.Nastran database or communicate directly with the MSC.Nastran program.

An example of its usage might go as follows: The user applies a DMAP Alter to have ISHELL execute within a DMAP sequence—upon executing the ISHELL module it would then spawn a user-supplied external program who’s function could be to read an output2 or output4 formatted FORTRAN file created in the current run. It could then use this data to write another output2 or output4 formatted file and then return to the main MSC.Nastran execution sequence. The DMAP can now access the newly created output2 or output4 file just created by the external program.

Toolkit Usage: Using the above example, the Toolkit can provide the same function using the following Toolkit API features:

1. The setting of a breakpoint at any DMAP statement.

2. The ability to read or write datablocks at this breakpoint.

3. The ability to allow the DMAP to continue to completion.

4. Or repeat the process by starting again at step 1.

• User-Modifiable MSC.Nastran:

Description: User-Modifiable MSC.Nastran allows user's to add their own features or modifications to MSC.Nastran. This capability is possible for those users who have requested the user modifiable version of MSC.Nastran. User Modifiable MSC.Nastran is intended for those users who have a good working knowledge of FORTRAN and have experience in programming on large-scale systems. (For more details you can request a copy of the User Modifiable MSC.Nastran User's Guide).

Toolkit Usage: The Toolkit provides an alternative approach to using User Modifiable MSC.Nastran. In certain applications the developer might find it easier to create a Toolkit application that interacts with the MSC.Nastran program. For example, the application developer might need to 1) Read existing tables and/or matrices, 2) Perform specific numerical calculations on this data, and 3) conclude by writing new or updating existing tables and/or matrices onto the MSC.Nastran database. Steps 1 through 3 might be repeated at selected points during the MSC.Nastran execution sequence.

Page 19: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

11CHAPTER 2Using the MSC.Nastran Toolkit

All these operations are similar to the functions of a typical DMAP module. With the Toolkit they can now also be done with the added convenience of not having to modify the MSC.Nastran program. The current limitation is that not all MSC.Nastran utility routines (e.g., memory management utilities, finite element utilities, and other useful functions for the implementation of structural element code) are available to the Toolkit client program.

What is the size of the Toolkit client object library?

Approximately 400k. This is the current NT object library size.

Does the Toolkit work with scripting languages like perl or python?

Although the first release of the Toolkit product will limit the supported language bindings to FORTRAN, C and Java, MSC found that adding additional languages bindings is a relatively straightforward process. In fact, a beta-version of a Perl language interface to the Toolkit has been developed. If you are interested in Perl or some other language binding please contact MSC.Software.

What future enhancements are planned for the Toolkit?

Enhancements are ongoing and are driven by both customer feedback and a continuing emphasis on ease-of-use improvements.

What kind of database functionality does the Toolkit provide?

Since the Toolkit provides full-access to all the capabilities of the MSC.Nastran database, the following list describes some of the important MSC.Nastran database features. (See MSC.Nastran Database Features (App. B) for more detailed descriptions.)

• Optimized (Machine specific) file access techniques.

• Qualified Datablocks ("keys" can be characters integers, or real values).

• SQL-like data retrieval using the above keys.

• Datablock equivalencing (ie., alias names).

• Data Definition’s for datablocks(Referred to as the NDDL—MSC.Nastran’s Data Definition Language)

• Flexible I/O utilities, such as utilities that return value(s), data types and labels for all data described on the databases).

• Each Database consists of DBSETS. A DBSET is a logical user-definable grouping of physical files that allows for large file allocation as well as flexible distribution of allocated space across separate physical storage units—datablocks can span physical files within a DBSET (see diagram in MSC.Nastran Database Features (App. B)).

• RAM DISK (available on Scratch DBSET).

Page 20: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

12

• Buffer cache (used by all DBSETs).

• DBSETs can be off-line (if not referenced).

• Automatic checkpointing of DBSET changes.

• Datablocks can be located on any DBSET.

• The database reuses released blocks to reduce high-water mark.

• Database is expandable on restarts.

• Automatic physical file tracking provides automated file attachments, and Database vs. physical file verification.

• Efficient and flexible I/O utilities:

• Read/write of partial records within a datablock (table or matrix)

• Access of data, its type and its label.

• Indexed matrices using optimized storage techniques.

• “Direct Access” positioning within datablocks (64 bit addressing).

• Utilities for accessing our new indexed (keyed) IFP and OFP data blocks (eg., geom1,geom2... and stress, strain, force, displacement datablocks).

Page 21: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

13CHAPTER 2Using the MSC.Nastran Toolkit

2.2 ReferencesThe following reference material is suggested for the developer responsible for writing code that will use the API described in this document.

1. User Modifiable MSC.Nastran User's Guide

Many of the I/O API’s dealing with access to MSC.Nastran datablocks (tables/matrices) are modeled after those already used within the MSC.Nastran application modules. Thus, API's dealing with open, read, write trailers, etc. can be better understood by studying the corresponding I/O utility subroutines described in the User Modifiable MSC.Nastran User's Guide.

2. MSC.Nastran Datablocks and DMAP Modules

This is an essential document for understanding MSC.Nastran data (tables and matrices) and the DMAP modules that generate them.

3. Example Toolkit Client Programs

Since examples are often the best way to understand an API, MSC.Software provides a series of example client programs as part of a Toolkit Code Librarian Help System.

Figure 2-1 MSC.Nastran Toolkit Code Librarian

Page 22: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

14

2.3 API SyntaxThe format of an API function is:

For C:

For FORTRAN:

Call NSxxxx (GrpName, ...arguments..., Error)

For Java:

xxxxReturns yyy = NServer_xxxx (GrpName, ...input arguments only...) See Appendix C for details.

The GrpName argument:

All API’s have as their first argument “GrpName.” This is a user-defined handle used to associate the API call with a specific server. It can be any string value. For example, if the API NServer_Start is called to make a server connection and uses “GrpName=my_server” then all subsequent API calls that will be communicating with this server should also use this name “my_server.” Since multiple server connections can be established within one Toolkit application (i.e., via multiple calls to the NServer_Start API) the Toolkit application can switch between these servers by simply referring to the appropriate GrpName value when calling an API.

Error Return:

The Error return value for all MSC.Nastran Toolkit functions is the value returned in the Error parameter. This value is also the function return value for C. This method of providing access to the Error flag from both the function parameters or from the function return value provides two advantages:

• The FORTRAN and C calling sequences are similar and thus easier to document and describe.

• The C programmer has more coding style flexibility in handling Error return values.

Note: Appendix D has a list of possible API error codes.

The following is an example of how the first API, NServer_Start, can be called from FORTRAN or C.

From FORTRAN:

int NServer_xxxx

( char *GrpName , arguments , INTEGER *Error );

Page 23: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

15CHAPTER 2Using the MSC.Nastran Toolkit

CHARACTER*255 COMLINE,GRPNAME,NASTPTH

INTEGER Error

GRPNAME = `ServerName`

COMLINE = ‘my_job.dat scr=yes mem=8mb`

NASTPTH = `nastran`

CALL NSSTART(GRPNAME,COMLINE,NASTPTH,ERROR)

From C:

int error; /* function return value */

INTEGER Error; /* same as function return value but as an argument */

char GrpName[] ={"ServerName"}; /* Define a name for the Server */

/* MSC.Nastran command line arguments */

char CommandLine[] ={"my_job.dat scr=yes mem=8mb"};

char NastPath[] ={"nastran"}; /* MSC.Nastran executable*/

error = NServer_Start(GrpName,CommandLine,NastPath,&Error);

Iret Return:

In addition to the Error return some API’s can have an Iret value. Iret is a flag word provides status information back to your the client code for the processing of API’s data. Iret =0 is normal status, whereas if Iret is non-zero some special processing is required. The meaning of non-zero Iret varies from API to API and can range somewhat benign indicators that more data is left to read, to more serious ones flagging user’s errors. When Iret and Error are present in the argument list of an API, both should be handled.

Page 24: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

16

Page 25: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

This section describes the Toolkit API's necessary for handling executive system operations. This class of API's provides the functions necessary to: 1) start the MSC.Nastran executable and execute DMAP Solution sequences, 2) set DMAP breakpoints, 3) read Toolkit error messages generated by the Toolkit middleware and/or by the MSC.Nastran program, 4) set time-out limits for the client and server processes, 5) submit additional MSC.Nastran input files (bdf's), and 6) provide the option of allowing a separate process to connect to an existing client-server connection to the MSC.Nastran server.

CHAPTER

3 Executive System APIs

■ Starting the MSC.Nastran Server

■ Stopping the MSC.Nastran Server

■ Setting DMAP Breakpoints

■ Submitting Additional MSC.Nastran Input Files

■ Executing Individual DMAP Modules

■ Setting Client and Server Timeout Limits

■ Executive APIs

Page 26: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

18

3.1 Starting the MSC.Nastran ServerOne of the first tasks of any Toolkit Client program is to establish a connection with MSC.Nastran. Unlike the traditional batch invocation of MSC.Nastran, a Toolkit Client program controls the execution using three API functions.

• The first API, NServer_Start, invokes the MSC.Nastran program similar to the standard batch command line method. It differs from the batch method in that the Toolkit invoked MSC.Nastran waits for a signal from the client program before beginning the actual execution of the DMAP solutions sequence.

• The second API, NServer_SolExeN, sends a signal to MSC.Nastran telling it to start the execution (i.e., start the DMAP compile/link operation followed by execution of the DMAP Solution Sequence).

• The third API, NServer_ExeStatus, can be called at any time in the client program after NServer_SolExeN in order to check if the currently executing DMAP solution sequence has completed—this API provides the option of either waiting until the server completes (i.e., client program goes into a wait state) or returning control to the client program (i.e., the client program can call NServer_ExeStatus again at a later time while it continues client-side only processing).

Note that the client program can start multiple MSC.Nastran servers by calling the above series of API's for each required connection. These servers can reside on the same or different machines than the client program.

Page 27: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

19CHAPTER 3Executive System APIs

3.2 Stopping the MSC.Nastran ServerOnce the Toolkit Client program is done interfacing with the MSC.Nastran server it can call NServer_Exit to request that the client be disconnected from the server and that the server perform the standard MSC.Nastran database shutdown and exit process (i.e., the same exit process used by the standard batch version of MSC.Nastran).

Page 28: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

20

3.3 Setting DMAP BreakpointsA specialized set of Toolkit APIs provide client-server communication and data transfer at any point within a DMAP Solution Sequence. This feature is comparable to an interactive language debugger. One or more DMAP breakpoints can be set prior to starting the DMAP execution (i.e., before NServer_SolExeN). The NServer_SetExeBreak API has options for requesting a breakpoint at every DMAP statement or only at those statements specifically referenced by Subdmap name and/or DMAP name and/or DMAP line number. An alternate method to using SetExeBreak for setting breakpoints is to include special HALT //$ statements at the desired breakpoint location in the DMAP solution sequence.

Page 29: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

21CHAPTER 3Executive System APIs

3.4 Submitting Additional MSC.Nastran Input FilesThe Toolkit provides an API for submitting multiple input files, including DMAP solution sequences, during one invocation of the client-server Toolkit program. In other words, you can submit an initial input file via the NServer_Start API and then when this analysis run is complete you can submit additional input files via the Toolkit API NServer_Input. These additional input files will run within the same database as established by the initial NServer_Start call.

Page 30: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

22

3.5 Executing Individual DMAP ModulesThe Toolkit provides an API, NServer_Evals, for directly evaluating/executing one or more DMAP Modules/statements. This differs from NServer_Input in that no input file or formal SubDmap/Solution sequence is required. The input to this API can be a simple request to execute a single DMAP statement (e.g., "ADD in1,in2/out1 $") or it can be a more complicated request containing multiple DMAP statements. This API can be called multiple times during the execution of a Toolkit client application.

Page 31: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

23CHAPTER 3Executive System APIs

3.6 Setting Client and Server Timeout LimitsThe Toolkit provides two functions for setting limits on the amount of time the client and/or server should wait for a response before returning from an API call. For example, if the server is taking longer to execute than a specified server timeout, then the client will return an Error 22 and will shut down the connection.

Control returns immediately upon a crash, independent of any timeouts settings made by these API calls. This also applies to the server in the case where the client crashes while the server is waiting for a response. If these default wait times set for the client and server are not sufficient for a particular application then the client program has the ability to set these limits using NServer_SetServerTimeout and NServer_SetClientTimeout.

Page 32: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

24

3.7 Executive APIs

NServer_Start - Start the MSC.Nastran Server

From FORTRAN:

CALL NSSTART(...)

From C:

Purpose. Interface call to start the MSC.Nastran Server. This will invoke the MSC.Nastran command program to perform the required start-up procedures necessary for the server (MSC.Nastran) invocation.

Arguments

Notes.

1. Other than the client-server communication required in this environment, the command program will perform the same function as it does for the batch (non-client-server) invocation of MSC.Nastran (e.g., input file verification, control file creation, and file cleanup upon MSC.Nastran job completion).

2. All subsequent communications between the client and the command program and/or the MSC.Nastran program will be through the established Inter-Process Communication (IPC) connection (i.e., sockets/rsh, or pipes).

3. The Command Line accepts the same keywords that MSC.Nastran allows for the batch (non-client-server) invocation method (see MSC.Nastran’s Quick Reference Guide (QRG) for a description of these keywords).

int NServer_Start

( char *GrpName , char *CommandLine , char *NastPath,INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication.

This identifier must be provided in subsequent API calls in order to communicate to a desired server. (Max. 256 chars.)

CommandLine INPUT MSC.Nastran Command Line. (Max 1025 chars)

NastPath INPUT Full path name to the executable shell script. (Max. 1025 chars)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 33: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

25CHAPTER 3Executive System APIs

Examples. These examples demonstrate how to invoke the MSC.Nastran server.

/* * Program Example1c.c * * Purpose: * * Demonstrates how to: * (1) start MSC.Nastran * (2) execute a DMAP solution sequence * (3) stop Msc.Nastran * * Usage: * ./Example1c <nastran command program> <nastran command keywords> * e.g., ./Example1c `which nastran` example1 scr=mini mem=10m out=example1c * * Method: * * The necessary Toolkit startup information is passed as * program arguments to example1c. * * It uses/generates the following files: * example1.dat: input to NASTRAN server : * example1c.prt: output from this program * example1c.f04, example1c.f06: output from NASTRAN server * * Toolit API's Called: * * NServer_Start * NServer_SolExeN * NServer_ExeStatus * NServer_Exit * * Utility functions Called: * * GetArgument * OpenLogFile * PrintMessage * * */

#include <stdio.h>#include <string.h>#include "nsapilib.h"

static FILE *LOGFILE = stderr;

void GetArgument( char *GrpName, char *NastPath, char *CommandLine, int argc, char *argv[]);

void OpenLogFile( char *CommandLine );

void PrintMessage (char *GrpName, FILE *fp, char *ApiName);

main(int argc, char *argv[]){ char GrpName[257]; char NastPath[1025]; char CommandLine[1025];

Page 34: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

26

INTEGER Error=0; INTEGER OutLen=0,MaxLen=40000; INTEGER Filept=0,Nmatch=0,Trailer[7];

char SubDmap[9], Dmap[9]; INTEGER Dmpseqnum=0, Nbreak=0, ibreak; INTEGER InitFlag, WaitMode=0, ExeStatus=0, Ndatablk=0, Nparam=0; INTEGER GEOM1Filept;

char ApiName[82]= {"main_program_at_exit" };

int i=0;

/************************************************************************ * * Step 1: Parse the program arguments into GrpName, NastPath and CommandLine * and then open a LogFile to write example1c output. * ************************************************************************ */

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv);

(void) OpenLogFile( CommandLine );

/************************************************************************ * * Step 2: Initilize the server * ************************************************************************ */ (void) NServer_Start ( GrpName , CommandLine , NastPath , &Error);

(void) fprintf(LOGFILE," >>> NServer_Start GrpName=%s\n" " CommandLine=%s\n" " NastPath=%s\n" " Error=%d\n", GrpName,CommandLine,NastPath,Error);

if( Error ) { strcpy( ApiName,"Nserver_Start"); goto EXIT; }

/*********************************************************************** * * Step 3: Start Execution of solution (non-wait mode) * *********************************************************************** */

(void) NServer_SolExeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolExeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolExeN"); goto EXIT; }

Page 35: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

27CHAPTER 3Executive System APIs

/******************************************************************** * * Step 4: Wait for the DMAP solution sequence to complete and * then print return values(i.e., last Subdmap/DMAP/line#) ******************************************************************** */ (void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

(void) fprintf(LOGFILE, " >>> NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Error); if( Error ) { strcpy( ApiName,"NServer_ExeStatus"); goto EXIT; }

/********************************************************************** * * Step 5: EXIT and terminate the server * ********************************************************************** */

EXIT: (void) PrintMessage (GrpName, LOGFILE, ApiName );

(void) NServer_Exit( GrpName , &Error );

(void) fprintf(LOGFILE," >>> NServer_Exit Error=%d\n",Error);

if( LOGFILE != stderr ) fclose (LOGFILE );}

Page 36: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

28

NServer_SolExeN - Execute the Current Solution Sequence

From FORTRAN:

CALL NSSOLEX(...)

From C:

Purpose. Interface call to execute a Dmap Solution from the data input file.

Arguments

Notes.

1. This function submit's a service call to the server to request the execution of MSC.Nastran with the input deck which has been previously supplied by either NServer_Start or NServer_ReadInput.

2. NServer_SolExeN will be executed by the Server in a non-blocking status after the service request has been received by the server.

3. Because of this API non-blocking feature the call to this API returns immediately back to the client's application. In order to check for the successful execution of this data file the client program must subsequently call NServer_ColNStat or NServer_ExeStatus.

Example. See NServer_Start example on page 25.

int NServer_SolExeN

( char *GrpName , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 37: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

29CHAPTER 3Executive System APIs

NServer_ColNStat - Wait for the Completion of a Prior NServer_SolExeN call

From FORTRAN:

CALL NSNSTAT(...)

From C:

Purpose. Interface call to collect the error status from the NServer_SolExeN function.

Arguments

Notes.

1. This function "waits" until the NServer_SolExeN function has completed execution of the input data file and its associated DMAP/Solution sequence.

2. Receives (reads) the error flag from the server after execution of DMAP/Solution sequence.

3. This function can only be called after the NServer_SolExeN function.

Example. . See the “Toolkit Code Librarian” help system.

int NServer_ColNStat

( char *GrpName , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 38: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

30

NServer_Exit - Exit and Terminate the Server

From FORTRAN:

CALL NSSEXIT(...)

From C:

Purpose. Interface call to exit and terminate the server

Arguments

Example. See NServer_Start example on page 25.

int NServer_Exit

( char *GrpName , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 39: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

31CHAPTER 3Executive System APIs

NServer_SetExeBreak - Set a Break Point in the DMAP Sequence

From FORTRAN:

CALL NSBREAK(...)

From C:

Function Description. Sets a break point in the Execution of DMAP Sequence

Arguments

Notes.

1. This API should be called before DMAP execution (e.g., before calling to NServer_SolExeN or NServer_SolResumeN).

int NServer_SetExeBreak

( char *GrpName, char *SubDmap, char *Dmap, INTEGER Dmpseqnum, INTEGER InitFlag, INTEGER *Nbreak, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

Subdmp INPUT (Max Length = 8)

SubDmap name where the Server should break

Dmap INPUT (Max Length = 8)

Dmap name where the Server should break. Note that the Dmap name can be the name of a Subdmap being called.

Dmpseqnum INPUT Dmap sequence number where the Server should break

InitFlag INPUT A control flag to set break

= 0 : remove all the breaks set previously

= 1 : when setting a break point

= 2 : reserved (don’t use)

= -1: Remove an entry in the break point list, using the Subdmp, Dmap and Dmpseqnum as currently defined

Nbreak OUTPUT Number of current entry in the break list which has a maximum of 100 entries

= -1 if the list overflows.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 40: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

32

2. A blank Subdmap, Dmap and/or Dmpseqnum=0 sets a break at each subdmap, dmap and dmpseqnum, respectively

Examples.

1. The first breakpoint example, Example2c, sets a breakpoint using the API NServer_SetExeBreak. The second example uses the alternate method of a HALT $ DMAP statement to set breakpoints.

Page 41: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

33CHAPTER 3Executive System APIs

Program Example2c* * Purpose: * * Demonstrates how to: * (1) start MSC.Nastran * (2) set a DMAP breakpoint * (3) execute the DMAP solution sequence * (4) check for Breakpoint to be reached and then continue execution * (3) stop MSC.Nastran * * Usage: * ./Example2c <nastran command program> <nastran command keywords> * e.g., ./Example2c `which nastran` example1 scr=mini mem=10m out=example1c * * Method: * * The necessary Toolkit startup information is passed as * program arguments to example2c. * * It uses/generates the following files: * example2.dat: input to NASTRAN server : * example2c.prt: output from this program * example2c.f04, example2c.f06: output from NASTRAN server * * Toolit API's Called:* * NServer_Start * NServer_SetExeBreak * NServer_SolExeN * NServer_ExeStatus * NServer_SolResumeN * NServer_Exit * * Utility functions Called: * * GetArgument * OpenLogFile * PrintMessage * * */ #include <stdio.h>#include <string.h>#include "nsapilib.h"

static FILE *LOGFILE = stderr;

void GetArgument( char *GrpName, char *NastPath, char *CommandLine, int argc, char *argv[]);

void OpenLogFile( char *CommandLine );

void PrintMessage (char *GrpName, FILE *fp, char *ApiName);

main(int argc, char *argv[]){ char GrpName[257]; char NastPath[1025]; char CommandLine[1025];

Page 42: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

34

char *DbdictString ={"DBDICT DATABLK(GEOM1) SELECT(NAME,DBSET,VERSON,SIZE,KEY)"};

char DbdictOut[40000];

INTEGER Error=0; INTEGER OutLen=0,MaxLen=40000; INTEGER Filept=0,Nmatch=0,Trailer[7];

char SubDmap[9], Dmap[9]; INTEGER Dmpseqnum=0, Nbreak=0, ibreak; INTEGER InitFlag, WaitMode=0, ExeStatus=0, Ndatablk=0, Nparam=0; INTEGER GEOM1Filept;

char ApiName[82]= {"main_program_at_exit" };

int i=0;

/******************************************************************************** * Step 1: Parse the program arguments into GrpName, NastPath and CommandLine* and then open a LogFile to write example1c output.** ******************************************************************************* */

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv);

(void) OpenLogFile( CommandLine );

/********************************************************************* * * Step 2: Initialize the server * ********************************************************************* */ (void) NServer_Start ( GrpName , CommandLine , NastPath , &Error);

(void) fprintf(LOGFILE," >>> NServer_Start GrpName=%s\n" " CommandLine=%s\n" " NastPath=%s\n" " Error=%d\n", GrpName,CommandLine,NastPath,Error);

if( Error ) { strcpy( ApiName,"NServer_Start"); goto EXIT; }/********************************************************** * * Step 3: Set up a break point after CALL IFPL subdmap * ********************************************************** */ strcpy( SubDmap, "DESOPT" ); strcpy( Dmap, "IFPL" ); Dmpseqnum = 0 ; /* no need for specific line number */ InitFlag = 1;

Page 43: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

35CHAPTER 3Executive System APIs

(void) NServer_SetExeBreak( GrpName , SubDmap , Dmap , Dmpseqnum , InitFlag , &Nbreak , &Error ); (void) fprintf(LOGFILE," >>> NServer_SetExeBreak: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " InitFlag=%d\n" " Nbreak=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,InitFlag,Nbreak,Error);

if( Error ) { strcpy( ApiName,"NServer_SetExeBreak"); goto EXIT; }/********************************************************* * * Step 4: Execution of solution in non-blocking mode * ********************************************************* */

(void) NServer_SolExeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolExeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolExeN"); goto EXIT; }/************************************************************* * * Step 5: Check for DMAP breakpoints or until DMAP EXIT * ************************************************************* */

WaitMode = 0;

for (ibreak=0 ; ibreak<Nbreak ; ibreak++ ) {

/***************************************************************** * * Step 5.a: Get the Dmap Execution status after the breakpoint * ***************************************************************** */ (void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

(void) fprintf(LOGFILE, " >>> NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Error); if( Error ) { strcpy( ApiName,"NServer_ExeStatus"); goto EXIT; }

Page 44: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

36

/************************************************************** * * Step 5.b: Get out of "for loop" at the "EXIT" DMAP statement * ************************************************************** */ if( !strncmp(Dmap,"EXIT",4) || Error ) break;

if( !strncmp(Dmap, "IFPL",4) ) {/* * At Break point IFPL */ (void) fprintf(LOGFILE," >>> Breakpoint IFPL\n");

}

/****************************************************************************** * * Step 5c: Resume DMAP execution after the breakpoint and loop back for the * next break point (note: breakpoint after "IFPL" will be "EXIT"). ***************************************************************************** /

(void) NServer_SolResumeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolResumeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolResumeN"); goto EXIT; }

} /* end of for loop */

/****************************************** * * Step 6: EXIT and terminate the server * ***************************************** */

EXIT: (void) PrintMessage (GrpName, LOGFILE, ApiName );

(void) NServer_Exit( GrpName , &Error );

(void) fprintf(LOGFILE," >>> NServer_Exit Error=%d\n",Error);

if( LOGFILE != stderr ) fclose (LOGFILE );}

Page 45: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

37CHAPTER 3Executive System APIs

2. This example sets Breakpoints using the HALT $ DMAP Statement:

HALT $

This DMAP statement defines a breakpoint in the DMAP sequence. DMAP execution will stop when the breakpoint is reached. The client program can check for a breakpoint by a call to NSEXSTA. DMAP execution is resumed by a call to NSRESUM. This is a more convenient way to define breakpoints when by using NSBREAK.

Example.

sol prtmatcompile prtmat listsubdmap prtmat $$type db, zuzr01 $$halt $matprn zuzr01 // $$end $diag 8cendbegin bulkenddata

______________________________________________________________________________DMAP execution will be stopped when the HALT statement is reached. Now the client program will place datablock ZUZR01 into the database. Subsequently, DMAP execution is resumed, and the MATPRN module will print datablock ZUZR01.

Page 46: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

38

NServer_ExeStatus - Return the status of the Executing Dmap Sequence

From FORTRAN:

CALL NSEXSTA(...)

From C:

Function Description. Status of the DMAP Sequence Execution.

Argument.

int NServer_ExeStatus

( char *GrpName, INTEGER WaitMode, INTEGER *ExeStatus, char *SubDmap, char *Dmap, INTEGER *Dmpseqnum, INTEGER *Ndatablk, INTEGER *Nparam, INTEGER *Error );

GrpName INPUT (Max Length = 256)Group name, the Server's unique identifier

WaitMode INPUT Waiting mode flag=> 0 : value of timeout in second to wait for the Server's response. If a zero value is set, it will wait forever.= -1 : return right back to caller if server is busy

ExeStatus OUTPUT Execution status= 0 : The Server is at a DMAP break point / EXIT= 1 : The Server is busy and not responding

Subdmp OUTPUT (Max Length = 8)SubDmap name if the Server at a break point / EXIT

Dmap OUTPUT (Max Length = 8)Dmap name if the Server at a break point / EXIT

Dmpseqnum OUTPUT Dmap sequence number if the Server at a break point / EXIT

Ndatablk OUTPUT Number of input, output datablocks at a break point / EXIT

Nparam OUTPUT Number of parameters available at a break point / EXIT

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

Page 47: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

39CHAPTER 3Executive System APIs

Application Notes.

Since the server executes the DMAP solution sequence ( see NServer_SolExeN ) in a non-blocking mode, this API outputs the status of the execution after calls to NServer_SolExeN or NServer_SolResumeN. If there was no breakpoint set, or if a breakpoint has been set but for some reason the DMAP breakpoint was not executed, then the NASTRAN server will eventually encounter an automatic breakpoint at the DMAP EXIT $ statement.

Note.

This NServer_ExeStatus API can replace the NServer_ColNStat which has limited functionality.

Example. See NServer_Start example on page 25.

Page 48: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

40

NServer_SolResumeN - Resume DMAP Execution After Stopping by Nserver_SetExeBreak

From FORTRAN:

NSRESUM(...)

From C:

Function Description. Resume the DMAP Execution after stopping at a DMAP break point.

Arguments

FORTRAN Interface.

CALL NSRESUM ( GrpName, Error )

Application Note.

This API should be called to continue the DMAP execution after a break point has been invoked. However, the application program can exit (NServer_Exit) or input another bulk data file (NServer_Input) to continue the execution. NServer_SolResumeN is a non-blocking call.

Example. See NServer_SetExeBreak example on page 32.

int NServer_SolResumeN

( char *GrpName, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

Page 49: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

41CHAPTER 3Executive System APIs

NServer_Evals - Evaluate a MSC.NASTRAN Module Command

From FORTRAN:

CALL NSEVALS(...)

From C:

Purpose. Interface call to evaluate/execute a MSC.Nastran module command.

Arguments

Notes.

1. One or more dmap lines can be packed in to a string. Use a semi-colon as the delimiter.

Example of C-program Application Usage:

(void) NServer_Evals ( "Linux_Server", "PARTN PG, COL,/,,PG1,/1 $loads", EvalOpt, &Status, &Error );

int NServer_Evals

( char *GrpName, char *EvalString, INTEGER EvalOpt, INTEGER *Iret, INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

EvalString INPUT String to evaluate/execute

EvalOpt INPUT Eval option, a combination of Qualifier and Dbview flag.

= 0 : Qualifier values not to be saved after NServer_Evals is executed. Dbview will not be inherited from previous execution state.

= 1 : Qualifier values will be saved.

= 2 : Dbview will be inherited from previous execution state.

= 3 : Qualifier values saved and DBview are inherited from previous execution

Iret OUTPUT Returns evaluation status.

=0 - OK

non-zero - evaluation error. Check Nastran Messages.

Error OUTPUT Server return error flag.

Page 50: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

42

NServer_FMS Command - Invoke ASSIGN or DBLOCATE FMS Commands

From FORTRAN:

CALL NSFMSCM(...)

From C:

Purpose: To invoke the FMS commands "ASSIGN" and "DBLOCATE" after the initial DMAP invocation (i.e., at a "breakpoint" after return from the NServer_Start call).

Arguments:

Notes.

1. You may specify new ASSIGN and/or DBLOCATE commands after a DMAP breakpoint has been reached. Note that one or more DMAP breakpoints is always set within a Toolkit application, either explicitly by specification of a breakpoint using the breakpoint API (NServer_SetExeBreak) or by taking the default (i.e., "EXIT" DMAP).

2. Only one ASSIGN or DBLOCATE statement per API call. Mutiple calls are allowed. ASSIGN’s should be made for files of particular database before the DBLOCATE call is made.

3. Command is currently limited to ASSIGN and DBLOCATE FMS statements.

Examples: (void) NServer_FMSCommand( "Linux_Server", "ASSIGN EXT1='./mydb.MASTER'", &Status, &Error);

int NServer_FMSCommand

( char* GrpName, char *FMSCommand , INTEGER *Iret, INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

FMSCommand INPUT The FMS commands (ASSIGN, DBLOCATE) See the MSC.Nastran User Reference Guide for description of these commannds)

Iret OUTPUT API's execution status

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 51: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

43CHAPTER 3Executive System APIs

(void) NServer_FMSCommand( "Linux_Server", "DBLOCATE LOGICAL=EXT1 DATABLK=(GEOM1,GEOM2)", &Status, &Error);

Page 52: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

44

NServer_Input - Prepares a New Input File for Execution by the Server

From FORTRAN:

CALL NSINPUT(...)

From C:

Purpose. Interface call to input a new data file (bdf) to the server.

Arguments

Note. This prepares for the execution of a new input data file and its associated DMAP Solution sequence. A subsequent call to NServer_SolExe will begin the execution of this input data file. Under normal circumstances, the NServer_Input command creates a new Project/Version in the current database, similar to the batch submittal of additional bdf’s to an existing database. It is possible to use DBLOCATE or RESTART statements within the .bdf file to point (or optionally copy) data from the previous PROJNO/VERSION to this one.

int NServer_Input

( char *GrpName , char *DeckName , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

DeckName INPUT Full path name of Input file to run MSC.Nastran. (Max. 256 chars.)

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 53: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

45CHAPTER 3Executive System APIs

Example.

/*

* Program Example4c.c

* Purpose: * * Demonstrates how to: * (1) start MSC.Nastran * (2) execute an initial DMAP solution sequence * (3) and then submit two additional input files and associated DMAP solution * sequences for execution by the MSC.Nastran server * (4) stop Msc.Nastran * * Usage: * ./Example4c <nastran command program> <nastran command keywords> * e.g., ./Example4c `which nastran` example1 scr=mini mem=10m out=example4c * * Method: * * The necessary Toolkit startup information is passed as * program arguments to example1c. * * It uses/generates the following files: * example4.dat: input to NASTRAN server : * example4c.prt: output from this program * example4c.f04, example1c.f06: output from NASTRAN server

Page 54: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

46

* * Toolit API's Called: * * NServer_Start * NServer_SolExeN * NServer_ExeStatus * NServer_Input * NServer_Exit * * Utility functions Called: * * GetArgument * OpenLogFile * PrintMessage * * */

#include <stdio.h>

#include "nsapilib.h"

main(int argc, char *argv[])

{

char GrpName[32];

char NastPath[1024];

char CommandLine[1024];

char DeckName[][128]={ "api2.dat","api3.dat" };

int i,nloop, loop, Error=0,coldstart=0;

/************************************************************************ * * Step 1: Parse the program arguments into GrpName, NastPath and CommandLine * and then open a LogFile to write example1c output. * ************************************************************************ */

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv); (void) OpenLogFile( CommandLine ); nloop = sizeof(DeckName)/128;

nloop++;

for( loop=0 ; loop<nloop ; loop++ ) {

Page 55: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

47CHAPTER 3Executive System APIs

/************************************************************************ * * Step 2: Initilize the server * ************************************************************************ */

if( loop == 0) {

(void) NServer_Start ( GrpName , CommandLine , NastPath , &Error); (void) fprintf(LOGFILE," >>> NServer_Start GrpName=%s\n" " CommandLine=%s\n" " NastPath=%s\n" " Error=%d\n", GrpName,CommandLine,NastPath,Error);

if( Error ) { strcpy( ApiName,"Nserver_Start"); goto EXIT; } else {

/************************************************************************ * * Step 3: Submit the next input file to be executed by MSC.Nastran * ************************************************************************ */

(void) fprintf(stderr,"\n\n **********"

"\n **********"

"\n **********"

" Hit RETURN to execute next data deck %s "

"\n **********"

"\n **********\n",

DeckName[loop-1]);

fgetc(stdin);

(void) fprintf(stderr, " Call NServer_Input for Group %s Deckname=%s\n",GrpName,DeckName[loop-1]); (void) NServer_Input ( GrpName , DeckName[loop-1] , &Error );

}

/*********************************************************************** * * Step 4: Start Execution of solution (non-wait mode) * *********************************************************************** */

Page 56: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

48

(void) NServer_SolExeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolExeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolExeN"); goto EXIT; }

/******************************************************************** * * Step 5: Wait for the DMAP solution sequence to complete and * then print return values(i.e., last Subdmap/DMAP/line#) * Since no DMAP breakpoints are set it should return Dmap="EXIT". ******************************************************************** */ (void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

(void) fprintf(LOGFILE, " >>> NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Error); if( Error ) { strcpy( ApiName,"NServer_ExeStatus"); goto EXIT; }

} /* end of for loop */

/********************************************************************** * * Step 6: EXIT and terminate the server * ********************************************************************** */

EXIT: (void) PrintMessage (GrpName, LOGFILE, ApiName );

(void) NServer_Exit( GrpName , &Error );

(void) fprintf(LOGFILE," >>> NServer_Exit Error=%d\n",Error);

if( LOGFILE != stderr ) fclose (LOGFILE );}

Page 57: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

49CHAPTER 3Executive System APIs

NServer_GetMessage - Get Error Messages Generated by the MSC.Nastran Server

From FORTRAN:

CALL NSGETMS(...)

From C:

Purpose. Interface call to retrieve messages generated by the MSC.Nastran server program. A call to this API returns and removes one message from the message stack. All current messages can be returned by calling this API in a loop until Message_Status=1. Use NServer_GetAllMessages if you want to filter the messages or repeatedly read a message.

Arguments

Example. See the PrintMessage function in Utility Functions (App. F).

int NServer_GetMessage

(char *GrpName, INTEGER lenmsg, char *fmsg, INTEGER *Message_Status)

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

lenmsg INPUT The number of characters available for storage in the fmsg character string.

fmsg OUTPUT Server error message. Note that each message output line (as normally appears in an MSC.Nastran F06 output listing) is returned as one string with end of line delimeters (e.g., “\n”) every 80 characters

Message_Status

OUTPUT Message Status

0= More Messages Remain

1= No More Messages

2= Message is Truncated

Func. Ret. OUTPUT Same as Message Status argument

Page 58: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

50

NServer_GetAllMessages - Retrieve All Error Messages Generated by MSC.Nastran Server

From FORTRAN:

CALL NSGMSGS(...)

From C:

Purpose. Retrieve all messages generated by the MSC.Nastran server program and store them on the Client under the handle msg_handle. Call NServer_MessageFilter to return filtered subset of these messages.

Arguments

Note:

1. Messages are removed from the server’s message stack and stored under msg_handle. Subsequent calls to NServer_GetAllMessage only returns new messages on the stack. Use NServer_MessageFilter to repeatedly read messages.

Example: See “Toolkit Code Librarian” Help system prtmes.f example.

int Nserver_GetAllMessages

( char *GrpName, INTEGER *msg_handle, INTEGER *num_messages, INTEGER * iret )

GrpName INPUT A unique identifier for the Client/Server communication.

(Max. 256 chars.)

msg_handle OUTPUT Message handle

num_messages OUTPUT Total number of messages associated with msg_handle.

iret OUTPUT Error return code.

0 = no error.

Func. Ret. OUTPUT Same as iret.

Page 59: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

51CHAPTER 3Executive System APIs

NServer_MessageFilter - Filter Error Messages Returned by NServer_GetAllMessages

From FORTRAN:

CALL NSMSGF(...)

From C:

Purpose. Routine to filter (using UNIX Regular Expression pattern matching capability) messages generated by the concatenation of returned messages from MSC.Nastran server program using NServer_GetAllMessages.

Arguments

int Nserver_MessageFilter

(INTEGER msg_handle, INTEGER *NxtMsg, char *pattern, INTEGER pattern_length, INTEGER pattern_case_flag, char* messages_found, INTEGER * iret )

msg_handle INPUT NServer_GetAllMessages message handle.

NxtMsg INPUT/ OUTPUT

Input -- starting message in msg_handle to search from. Output -- next message number matching pattern

pattern INPUT The pattern string of regular expression.

pattern_length INPUT The character string length specification.

A non-negative integer value containing the actual length of thecharacter data associated with pattern string. Note that this length must not include any terminating null characters. A length of 0 indicates that the pattern string is empty.

An integer -1 value (or any negative value) if the length is implicit within the pattern string itself. For the FORTRAN callable entries, the implicit string length value will be used. Forthe “C” callable entries, the pattern string must be a standard null-terminated string.

pattern_case_flag INPUT Specify what case conversion, if any, is to be performed on the pattern.

0 = no case conversion is to be done.

1 = all characters are to be converted to upper case.

2 = all characters are to be converted to lower case.

messages_found OUTPUT message containing pattern. (800 chars)

Page 60: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

52

Example: See “Toolkit Code Librarian” prtmes.f example.

iret OUTPUT Error return code.

0 = no error.

Function return OUTPUT Same as iret.

Page 61: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

53CHAPTER 3Executive System APIs

NServer_FreeMessages - Free Messages Allocated by NServer_GetAllMessages

From FORTRAN:

CALL NSFMSGS(...)

From C:

Purpose. Frees messages and memory allocated by NServer_GetAllMessages.

Arguments

Example: See “Toolkit Code Librarian” prtmes.f example.

int Nserver_FreeMessages

( INTEGER msg_handle )

msg_handle INPUT NServer_GetAllMessages message handle

Page 62: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

54

NServer_SetServerTimeout - Set a Time Limit that the Server Will Wait in a "blocking" Mode for a Client Response

From FORTRAN:

CALL NSSRTMO(...)

From C:

Purpose. Interface call to set a time-out on the server to avoid any possible cases of inifinte blocking in the case of client failure.

Arguments

Note.

Default timeout is 10,000 sec.

Example. See NServer_SetClientTimeout on page 55.

int NServer_SetServerTimeout

((char *GrpName, INTEGER timeout, INTEGER *Error)

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

timeout INPUT Timeout value in seconds

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 63: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

55CHAPTER 3Executive System APIs

NServer_SetClientTimeout - Set a Time Limit that the Client Will Wait in a "blocking" Mode for a Server Response

From FORTRAN:

CALL NSCLTMO(...)

From C:

Purpose. Interface call to set a timeout on the client to avoid any possible cases of infinite blocking in the case of server failure.

Arguments

Note.

Default timeout is 10,000 sec.

Example. Code snippet illustrating use of the SetClientTimeout API/SetServerTimeout (to increase the default wait time from the current default of 10,000 seconds).

int NServer_SetClientTimeout

(char * GrpName, INTEGER timeout, INTEGER *Error)

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

timeout INPUT Timeout value in seconds

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 64: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

56

/* Note: This is only a code "snippet"--the complete source can be found in the MSC.Nastran Code Librarian Help System. */

/* INIT THE SERVER */

Nserver_Start ( GrpName , CommandLine , NastCommand , &Error);

If( Error ){ (void) fprintf(fp, "Error in NServer_Start error = %d\n", Error); goto exit; }/* SET THE CLIENT WAIT TIMEOUT for 20000 seconds Note: All subsequent NServer_xxxx calls will wait 20000 seconds for A server response--if the wait is longer then the waiting API will disconnect the client from the server and return with an Error-- */(void) NServer_SetClientTimeout ( GrpName, 20000 , &Error);

/* SET THE SERVER WAIT TIMEOUT for 50000 seconds Note: The Server will wait for 50000 seconds for a response from this Client program--if the wait is longer then the Server will disconnect from the Client--the next client API call will then return with an error message (depending on the platform the client API will either immediately return with a "Server has crashed" error message (NT platforms) or return with a "Client Timeout" error message after the NServer_SetClientTimeout limit has been reached (UNIX platforms) */

(void) fprintf(fp, " Call NServer_SetServerTimeout %d\n", 50000 );(void) NServer_SetServerTimeout ( GrpName, 50000 , &Error);

/* EXECUTION OF SOLUTION IN NON-BLOCKING MODE */

(void) NServer_SolExeN( GrpName , &Error );

if( Error ){ (void) fprintf(fp, "Error in NServer_SolExeN error = %d\n", Error);

goto exit; }

/* COLLECT NON-BLOCKING STATUS ("waits" for DMAP Solution to complete) Note: Due to previous SetClientTimeout call NServer_ColNStat will wait 20000 seconds for a response from the Server--if no response during that time than the client will be disconnected from the Server and a Fatal Error message will be issued by NServer_ColNStat.*/

(void) NServer_ColNStat( GrpName, &Error );

if( Error ) {

(void) fprintf(fp, "Error in NServer_ColNStat error = %d\n", Error);

goto exit; }exit:

/* Note: This is only a code "snippet"--the complete source can be found in the MSC.Nastran Code Librarian Help System. */

Page 65: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

57CHAPTER 3Executive System APIs

NServer_SavEnv - Save the Server’s IPC Environmental Table for a Later Reconnection from Another Client Program

From FORTRAN:

CALL NSSAVEN(...)

From C:

Function Description. Save client-server environment necessary for a child process re-connection.

Arguments.

Application Note.

This API must be called after the connection to the server has been established. This API saves the system information that is needed for a child process to re-connect to the parent’s client-server connection--the child process performs the re-connection by calling NServer_Restart with the EnvName used by the prior call to NServer_GetEnv.

Example. See the example provided for NServer_Restart page 58.

int NServer_SavEnv

( char *GrpName, char *EnvName, INTEGER *Error);

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

EnvName INPUT Name of the Environment (Max. 1025)

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

Page 66: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

58

NServer_Restart - Restart the Server from Another Client Program

From FORTRAN:

CALL NSRESTA(...)

From C:

Function Description. Start the NASTRAN Server.

Arguments

Application Notes.

This API must only be used in a child process after NServer_SavEnv (NSSAVEN) has been called in the parent process.

NServer_Restart is available for UNIX FORTRAN and C language bindings only.

Example. This following example demonstrates how to reconnect a child process to a parent process's existing client-server connection.

int NServer_Restart

( char *GrpName, char *EnvName, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

EnvName INPUT (Max Length = 1024)

Env name

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 67: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

59CHAPTER 3Executive System APIs

/* * Program Nshalt.c * * Purpose: To Demonstrate how to: * (1) Set a DMAP "breakpoint" using NServer_SetExeBreak, * (2) followed by starting a child process, Nsrecon. * (3) Then this example shows how the child process * can re-establish the parent’s client-server connection * * * Usage: NShalt <nastran command program> <nastran command keywords> * e.g., ./NShalt `which nastran` d200c01 scr=mini mem=10m * * Demonstrates how to: * (1) set a DMAP "breakpoint, * (2) and then after stopping at this breakpoint, * (3) start another process that re-connects to the server. * * * Method: * * The necessary Toolkit startup information is passed as * program arguments to Nshalt. * * It uses/generates the following files: * NShalt.dat: input to NASTRAN server : * NShalt.prt: output from this program * NShalt.f04, NShalt.f06: output from NASTRAN server * * Toolit API's Called: * * NServer_Start * NServer_SetExeBreak * NServer_SolExeN * NServer_SavEnv * NServer_Restart * NServer_ExeStatus * NServer_SolResumeN * NServer_Exit

* * Utility functions Called: * * GetArgument * OpenLogFile * PrintMessage * * */

#include <stdio.h>#include "nsapilib.h"

void GetArgument( char *GrpName, char *NastPath, char *CommandLine, int argc, char *argv[]);int Fetch_Messages (char *GrpName, FILE *fp);

main(int argc, char *argv[]){

Page 68: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

60

char GrpName[257]; char NastPath[1025]; char CommandLine[1025]; char *EnvName;

char SubDmap[9], Dmap[9]; INTEGER Dmpseqnum, Nbreak, InitFlag; INTEGER WaitMode, ExeStatus, Ndatablk, Nparam, Error;

/******************************************************************************** * Step 1: Parse the program arguments into GrpName, NastPath and CommandLine* and then open a LogFile to write example1c output.** ******************************************************************************* */

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv);

(void) OpenLogFile( CommandLine );

/********************************************************************* * * Step 2: Initialize the server * ********************************************************************* */

(void) fprintf(LOGFILE," Call Nserver_Start for Group=%s\n" " CommandLine=%s\n" " NastPath=%s\n", GrpName,CommandLine,NastPath);

(void) NServer_Start ( GrpName , CommandLine , NastPath , &Error);

if( Error ) { strcpy( ApiName,"Start"); goto EXIT; } /* * (2a) Set the solution breakpoints prior to executing DMAP */

strcpy( SubDmap, "DESOPT" );

Dmap[0] = '\0';

Dmpseqnum = 52; /* a call subdmap */

InitFlag = 1;

(void) fprintf(LOGFILE, " Input to NServer_SetExeBreak: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " InitFlag=%d\n", SubDmap,Dmap,Dmpseqnum,InitFlag);

Page 69: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

61CHAPTER 3Executive System APIs

(void) fprintf(LOGFILE, " Call Nserver_SetExeBreak to set 1st DMAP breakpoint\n");

(void) NServer_SetExeBreak( GrpName , SubDmap , Dmap , Dmpseqnum , InitFlag , &Nbreak , &Error );

(void) fprintf(LOGFILE, " Return from NServer_SetExeBreak: Nbreak=%d\n" " Error=%d\n", Nbreak,Error); If( Error ) { strcpy( ApiName,"SetExeBreak"); goto EXIT; } /*

* (3) Execution of solution in non-blocking mode */

(void) fprintf(LOGFILE, " Call NServer_SolExeN to execute the DMAP solution\n");

(void) NServer_SolExeN( GrpName , &Error ); If( Error ) { strcpy( ApiName,"SolExeN"); goto EXIT; }

/* * (4) Prepare for for the execution of the second Client program NSrecon */

EnvName = GrpName;

(void) NServer_SavEnv ( GrpName, EnvName, &Error); If( Error ) { strcpy( ApiName,"SavEnv"); goto EXIT; }

sprintf (CommandLine, "./NSrecon %s\n ",EnvName) ;

/* * (5) Loop over the breakpoints, either a breakpoint Dmap or an EXIT Dmap has been hit */

WaitMode = 0;

for ( ; ; ) {

/* * (5a) Get the Dmap Execution status after the breakpoint * * Note: * * There are is one break point. * Once the Dmap execution hits this breakpoint, * it returns control to the client program. * The Dmap Sequenvce Number Dmpseqnum is output here to * show the location of the breakpoint in the dmap sequence.

Page 70: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

62

* * In this example, at the breakpoint, another task NSrecon * NSrecon will be submitted. This new task re-connects * to the server and requests "DBDICT" output. */ (void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

(void) fprintf(LOGFILE, " Return from NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Ndatablk=%d\n" " Nparam=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Ndatablk,Nparam,Error);

if( !strncmp(Dmap,"EXIT",4) || Error ) { Strcpy( ApiName,"COMMANDLine"); goto EXIT; }

/* * (5b) Submit the second program NSrecon to reconnect the NASTRAN server */

Error = system( CommandLine ); If( Error ) { Strcpy( ApiName,"COMMANDLine"); Goto EXIT; } /* * (5c) Resume the Dmap execution after the breakpoint */

(void) NServer_SolResumeN( GrpName , &Error );

if( Error ) { strcpy( ApiName,"NServer_SolResumeN"); goto EXIT; } }

/* * (6) Retrieve Error message (if any) and * Close the Server */

/****************************************** * * Step 6: EXIT and terminate the server * ***************************************** */

EXIT: (void) PrintMessage (GrpName, LOGFILE, ApiName );

(void) NServer_Exit( GrpName , &Error );

Page 71: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

63CHAPTER 3Executive System APIs

(void) fprintf(LOGFILE," >>> NServer_Exit Error=%d\n",Error);

if( LOGFILE != stderr ) fclose (LOGFILE );}

}/* end of Nshalt.c *//*****************************************************************************//*****************************************************************************//* * File: Nsrecon.c * * Purpose: To reconnect NASTRAN server * * This program is executed by another program NShalt * */

#include <stdio.h>#include "nsapilib.h"

int main (int argc, char *argv[]){ char GrpName[257]; char *EnvName;/*

* The following DbdictString allows the same format as that used for * MSC.Nastran DBDICT module */ char *DbdictString = {"DBDICT DATABLK(EPT,GEOM2,OES1,OUGV1,DVPTAB,DESTAB,PROPO)"}; char DbdictOut[40000]; int OutLen,MaxLen=40000;

INTEGER Error;

/* * (1) Parse the program arguments in to GrpName, NastPath and CommandLine */

strcpy( GrpName, argv[1] ); EnvName = GrpName;

/* * (2) Re-connect to the NASTRAN server */ (void) fprintf(stderr," Call NServer_Restart for Group=%s\n" " EnvName=%s\n", GrpName,EnvName);

(void) NServer_Restart ( GrpName , EnvName , &Error);

if ( Error ) goto EXIT;

/*

Page 72: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

64

* (3) DBDICT * (output from DBDICT function the same as standard MSC.Nastran DBDICT output) */

(void) NServer_Dbdict ( GrpName , DbdictString , DbdictOut , MaxLen, &OutLen , &Error ) ;

if ( Error ) goto EXIT;

(void) fprintf(stderr, " Call NServer_Dbdict Return OutLen=%d DbdictOut=\n%s", OutLen,DbdictOut);

EXIT: Return (int) Error;

}

Page 73: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

65CHAPTER 3Executive System APIs

NServer_GetEnv - Get MSC.Nastran Execution Environment Resources

From FORTRAN:

CALL NSGETEN(...)

From C:

Purpose. Returns MSC.Nastran environment information.

Arguments

int NServer_GetEnv

(char *NastPath , const char *Attributes , INTEGER *Num_Attributes, char *Att_Names, char *Att_Values, char *Att_Source, INTEGER *Error );

NastPath INPUT MSC.Nastran Command Line

Attributes INPUT A string containing comma separated list of attributes to fetch information on. For example, the user may pass in mem, scr, dbs, sdir, ver to inquire about these five MSC.Nastran execution environment variables.

Num_Attributes OUTPUT Number of attributes found.

Att_Names OUTPUT Names of valid Attributes found in the Attributes parameter. The size of the array shall be [ 80 X * Num_attributes ]. This array must be sized by the calling routine based on the number of parameters passed in the Attributes input string.

Att_Values OUTPUT Values of valid Attributes found in the Attributes parameter. The size of the array shall be [ 80 X * Num_attributes ]. This array must be sized by the calling routine based on the number of parameters passed in the Attributes input string.

Att_Source OUTPUT Source of valid Attributes found in the Attributes parameter. This variable will contain information about which rc file was used to extract the instance value for the Attribute. The size of the array shall be [ 80 X * Num_Attributes ]. This array must be sized by the calling routine based on the number of parameters passed in the Attributes input string.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 74: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

66

Note.

This function interacts only with the MSC.Nastran command program and as such does not invoke the MSC.Nastran solver. As a result, it can be invoked numerous times without incurring any significant performance penalty.

This function is similar to the Nastran command program’s “whence” keyword. The returned attribute values from the “whence” keyword only reflect the values set by the Nastran command program and the Nastran “RC File”. Note: If an attribute is not set by one of these methods it will be returned as a NULL string.

Example. Code snippet demonstrating the NServer_GetEnv API.

#include "stdmsc.h" int main() { INTEGER error=0, num=0, Error=0; int i=0; char attn[800], attv[800], atts[800]; num=3; Error=NServer_GetEnv("/nast/bin/nast2003t1","scr,mem,sdir",&num,attn,attv,atts,&error); printf("num=%d , error=%d, Error=%d\n",num,error,Error); if (Error == 0 || Error == 1) { for (i=0; i<num ; i++) { printf("Name=%s\n",&attn[i*80]); printf("Value=%s\n",&attv[i*80]); printf("Source=%s\n",&atts[i*80]); } } return error; }Outputnum=3 , error=1, Error=1Name=scratchValue=noSource=program defaultName=memoryValue=Source=program defaultName=sdirectoryValue=/scratchSource=/nast/conf/nast2003t1rc[2]

Page 75: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

67CHAPTER 3Executive System APIs

NServer_CheckToolkit - Check the Compatibility of the Toolkit Client and MSC.Nastran Server

From FORTRAN:

CALL NSCHKTK(...)

From C:

Purpose. Interface call to Interrogate whether the release version of the Toolkit client API is compatible with the MSC.Nastran server pointed to by the “GrpName” group.

Arguments

Note.

If it is found that the client and server are not compatible the error flag will be set accordingly and a message will be written to the API’s error stack. The specific changes causing the incompatibility between the client and server will be documented on each release of the Toolkit in the nsapilib.h file contained on the Toolkit delivery CD.

Example message output:

*** SYSTEM INFORMATION MESSAGE 6498 (NASAPI, SendCheckTool) API MESSAGE FOLLOWS. USER INFORMATION: No Error Encountered.

int NServer_CheckToolkit

( char *GrpName , INTEGER *Compatible, INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Compatible OUTPUT Server return error flag ( 0 - compatible, nonzero value - noncompatible). Each bit of Compatible represents a different level of client/server compatibility. See table within Note for the definition of the levels.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 76: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

68

*Although one or more differences may exist, Toolkit APIs may still be compatible.

if then

bit on difference found in *

1

2

3

4

major version

minor version

special

round

Page 77: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

This section describes the MSC.Nastran database API's necessary for 1) determining the contents of an existing database, 2) creating new datablocks (tables/matrices), and 3) retrieving/accessing existing datablocks from a database.

There are many ways to interface your client program with an existing database or solution sequence. Merits and difficulties of this connection depend on just what your client program needs to do. It can range from the relatively simple retrieval of permanently stored data on a MSC.Nastran database to the more complex halting of a running solution sequence to read, update, or add datablocks. The solution sequence could be your own instead of one supplied by MSC.Software. Here we will outline several methods that you might employ to connect with the database.

CHAPTER

4 Database Features and APIs

■ Retrieving Data From a Database

■ Database Utilities

Page 78: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

70

4.1 Retrieving Data From a DatabaseOften client programs wish to retrieve data from a job that was submitted previously. Here there is no need to interactively monitor or to update data as the job runs. A good example is you wish to retrieve stored stress, force, displacement, etc. results.

Make sure that the information you want to retrieve is being permanently stored. The job must have been submitted with scr=no or scr=mini and the solution sequences must be defined (or altered) to store this data. Typical results output from MSC’s solution sequences are indexed and permanently stored if scr=no or scr=mini and sys316=3 is used when submitting the job.

The client program connects with this database using a small deck that attaches and points to the permanent data by DBLOCATE FMS statement. Although the current job which is run by the client program is a scratch run, it can access all the projects, versions, and datablocks that have been stored on the previous run’s database. The previous run’s database will not be altered by anything that is done during this client job. Indeed, you can simultaneously run several client jobs that point to the same database using this method.

INIT MASTER(S)ASSIGN DB1='\your_master_dbset_name'DBLOCATE DATABLK=*,LOGICAL=DB1, WHERE(VERSION>0 AND, PROJECT=*),CONVERT(PROJECT=PROJECT;VERSION=VERSION)SOL LOADNDDLCENDBEGIN BULKENDDATA

Using the database information retrieval API's (NServer_Dbdict...), you can retrieve a list of the available/existing datablocks on the database. [Note: There also exists a set of API's (e.g., NServer_GetPathNameQualifiers, GetDatablockPathName,…) that Toolkit developer's will find useful for more advanced applications where it's necessary to retrieve general database schema information (e.g., qualifier names/values) for datablocks prior to their existence on the database]. After choosing the qualified datablock you wish to read, you can use one of the various read access toolkit API's. You can choose from either the sequential access API's (described in Chapter's 6 and 7) or the direct access ("keyed") API's (described in Chapter 8). Typically, Toolkit application writers will prefer to use the direct access API's since they not only provide direct access to data at the "element/grid" and/or "Subcase" entry level, they also provide the ability to perform "filtering and projection" operations (e.g., "select (sx, sy), where(sx<1.0E03)"), data labeling (e.g., "sx, sy") and type definition ("integer, real, character") of the retrieved data. The sequential access API's may be preferred over the direct access API's in those cases where simple "blast" reading/writing of large amounts of unfiltered data is required. However, be aware that sequential access often requires a more detailed knowledge of the datablock's internal data structure.

Page 79: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

71CHAPTER 4Database Features and APIs

This basic method can be modified in minor ways. If you remove the init master(s) statement from the deck above and you submit the client job as scr=no, then the database created by the client job will be made permanent and you will be able to store datablocks permanently. Still, the DBLOCATE’d database information will remain separate and read-only.

You could provide your own solution sequence instead of the LOADNDDL. Then the DBLOCATE’d job becomes a source for some information which your client program could manipulate in some way, write back to the current database, and could further process through DMAP . Some client programs need to be set up so they can modify or process data while a solution sequence is running. The needs of the client program are slightly different than in the case specified above in that the client needs to somehow affect the data or the control of a solution sequence (interactively or batch) while it is running. You could do the same process using case 1, but it would have to be done in (perhaps) many stages as several separate jobs. This technique allow the client code to do it as one job.

A good conceptual example might be what would be required to build you own optimizer outside MSC.Nastran. Here you would want to input the model and come up with an initial solution within the existing solution sequences, then have your client code stop the run, check for convergence, and if not converged modify (perhaps) properties information on the database, and loop back through the solution sequence with the modified properties.

Here you are interfacing with the data model that is used by MSC. While the Toolkit calls are simple, the details of getting and modifying existing datablocks can be difficult. Client programs need to 1) find the proper position to “Halt”,2) to find out which datablock qualifiers are important so you can allocate a datablock, and 3) you must know how to read and write the datablock in the MSC defined form.

The following are examples of the API’s needed to access/read existing datablock(s) on the database:

• Using the sequential access API’s:

• NServer_AllocDatablk

• NServer_OpenDatablk

• NServer_ReadRecord

• NServer_Close

• Using the direct access API’s:

• NServer_SelectOFP --get results for selected elements and subcases

• NServer_GetNextEntry --advance to next entry

• NServer_GetLen --get the length of the current entry

• NServer_GetData --get the data (e.g., 1.0E03, 1.3E03)

• NServer_GetLabels --get the labels (e.g., "sx1","sx2")

Page 80: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

72

• NServer_GetTypes --get the types (e.g., real)

• Loop back to NServer_GetNextEntry

Page 81: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

73CHAPTER 4Database Features and APIs

4.2 Writing Data to a DatabaseAssume that the client program needs to write a new datablock to the database and that datablock will be used in a subsequent DMAP statement in the solution sequence. The easiest method of adding a new permanent datablock to a solution sequence is to use the zuzr11-zuzr20 set of predefined datablock names. These names are available for use in all the solution sequences 100+. In fact, the zuzr11 datablocks are also used by the SUBDMAPS DBSTORE and DBFETCH for the users use in alters. The toolkit can also interface through zuzr11 datablocks but instead of altering, use the toolkit NServer allocation and write commands. The client program needs to determine the set of qualifiers that are present with a particular datablock name. This list is necessary when a datablock is allocated for write (or read).

Going to the NDDL description you see that:

DATABLK ZUZR11 TYPE=MATRIX PATH=ZNAME LOCATION=DBZUZR

and

PATH ZNAME ZNAME,ZUZR1,ZUZR2,ZUZR3

and

QUAL(CHAR8) ZNAME=' ' QUAL(I) ZUZR1=0,ZUZR2=0,ZUZR3=0

Thus, the qualifiers for zuzr11 are zname (which is a character string used by dbstore as a datablock name), and three integer qualifiers. The client program then could allocate a zuzr11 datablock with appropriate NServer_CreateDatablk of:

char *Create={"DATABLK=ZUZR11 QUALS(ZNAME='MYDB'; ZUZR1=1)"}; NServer_CreateDatablk(GrpName,Create,&Filept,&FileStat,&Error);

Then open this datablock for write, write to the datablock, close it, and write its trailer (you must write a data block trailer if the datablock is to be accessible to DMAP). After these operations are done, the DMAP can access the new datablock created by your client code by various methods:

The easiest is to use the CALL DBFETCH statement.

call dbfetch /mydb/1/0/ ..... tabpt mydb,,,,// $

CALL DBFETCH does the work equivalencing zuzr11 with zname=’mydb’, zuzr1=1 to a datablock called MYDB. Using this method the datablock MYDB is available to this subdmap and can be passed to subsequent ones.

Or, you can dbview this datablock in a particular subdmap by:

dbview mydb=zuzr11 where(zname='MYDB' and zuzr1=1 and wildcard) tabpt mydb,,,,// $

Page 82: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

74

With the dbview statement you can refer to mydb anywhere within the current subdmap, but cannot be passed to another subdmap. Another dbview must be set up in each subdmap you wish to use this datablock.

Finally, you can explicitly set the qualifiers in the dmap and the datablock created by the client can be read by its zuzr11 name.

type parm,i,nddl,n,zuzr1,zuzr2,zuzr3 type parm,char8,nddl,n,znamezname='MYDB' zuzr1=1 zuzr2=0 zuzr3=0 tabpt zuzr11,,,,,// $

Of course you are not restricted by the Toolkit to just using the zuzr11 names. You can use the normal solution sequence names. Using these names is appropriate when you wish to modify some of the contents of these datablocks or wish to create them outside the normal solution sequences. All datablock names that are contained in the NDDL are available for use.

The only complicating factors in use of these names are the appropriate integration of the datablock and its qualifiers with their use in the existing solution sequence structure. It is probably much easier to modify the EPT (Element Property Table) for optimization using this name than to try using zuzr11 and equivalencing. If you use an existing name you must:

• Look up the list of qualifiers which go with the datablock.

• Make sure that they are set to the proper values for a solution sequence where you have halted or to the values to the location you wish these datablocks should be used.

If you are creating a datablock (or a family of datablocks) that is to be used in a solution sequence your client code needs to:

• NServer_CreateDatablk

• NServer_OpenDatablk

• NServer_WriteRecord, NServer_Pack...)

• NServer_Close

• NServer_WriteTrailer

The logic of the qualifier setting that is in the DMAP already will make the appropriate datablock available in the solution sequence as it executes without further altering.

Finally, you can create your own Delivery Database, with Datablock names and qualifiers that you feel appropriate to your client code. With this method you have the full range of functionality available to you.

Page 83: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

75CHAPTER 4Database Features and APIs

4.3 Database Utilities

NServer_AllocDatablk - Allocate an Existing MSC.Nastran Datablock

From FORTRAN:

CALL NSALLDB(...)

From C:

Purpose. Interface call to locate existing datablock(s) (using the specified AllocString (where clause)) in the MSC.Nastran database and then to create the necessary internal data structures needed for a subsequent call to the NServer_OpenDatablk function.

Arguments.

Notes.

1. If the where clause/expression does not contain a specification for all qualifiers then "WILDCARD=TRUE" should be specified.

Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_AllocDatablk

( char *GrpName , char *AllocString , INTEGER *Filept ,INTEGER *Nmatch , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

AllocString INPUT A string with a WHERE clause describing the path of the datablocks. Note: The WHERE clause is the same as MSC.Nastran’s DMAP statement DBVIEW.

Example of an AllocString to allocate datablock ZUZR11:"DATABLK=ZUZR11 WHERE(ZNAME='MYDB'AND ZUZR1=1)"

Filept OUTPUT Return File Handle for future reference to the allocated datablock.

Nmatch OUTPUT Return number of matching datablocks. Only the first Filept is returned.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 84: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

76

NServer_CreateDatablk - Create a New Datablock (table or matrix)

From FORTRAN:

CALL NSCRTDB(...)

From C:

Purpose. Interface call to create a new database entry for a datablock in the MSC.Nastran database (using the specified CreateString (where clause), to set the datablocks qualifier values), and to also create the necessary internal data structures needed for the subsequent call to the NServer_OpenDatablk function.

Arguments.

Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_CreateDatablk

( char *GrpName , char *CreateString , INTEGER *Filept , INTEGER *FileStat , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

CreateString INPUT A string used to describe the path (NDDL defined “key” values) of the datablock to be created on the database.

Example of a CreateString to create datablock ZUZR11: "DATABLK=ZUZR11 QUALS(ZNAME='MYDB'; ZUZR1=1)"

(Max. 1025 chars.)

Filept OUTPUT Return File Handle for future reference of the allocated datablock.

FileStat OUTPUT Return File Status:

0 for creating new datablock.

1 for overwriting existing datablock.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 85: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

77CHAPTER 4Database Features and APIs

NServer_Dbdict - Find One or More Datablocks and/or Parameters Based on Key Values

(Functionally this is the same as the MSC.Nastran DBDICT command.)

From FORTRAN:

CALL NSDBDIC(...)

From C:

Purpose. To find one or more datablocks and/or parameters based on Key values—functionally the same as the FMS statement DBDICT.

Arguments. Note that reference to DBDICT will be used in the following descriptions since this API is the functional equivalent of that command.

See the MSC.Nastran Quick Reference Guide for a detailed description of the DBDICT capabilities and the various output options.

int NServer_Dbdict

( char *GrpName , char *DbdictString ,char*DbdictOut , INTEGER MaxLen, INTEGER *OutLeng , int *Error )

GrpName INPUT An unique identifier for the Client/Server communication.

DbdicString INPUT String containing the input request to DBDICT (Max 1024)

DbdictOut OUTPUT String containing the output from the DBDICT function.

MaxLen INPUT Max. length available for dbdictout string.

Note that if MaxLen is insufficient to hold the returning value to be stored in DbdictOut then nothing will be returned in DbdictOut. However, in this case OutLeng will contain the required length so that a subsequent call can be made to NServer_Dbdict with sufficient space allocated for DbdictOut

OutLeng OUTPUT actual length needed for DbdictOut string.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 86: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

78

NServer_DbdictBuildTable - Tokenize DBDICT Data into a Table

From FORTRAN:

CALL NSDBTAB(...)

From C:

Purpose. Associates a file handle with the output of a DBDICT request. This API tokenizes the DBDICT output to form a spreadsheet like table where columns are the DBDICT SELECT clause attributes and the rows are individual datablocks (or parameters) stored on the database. Other API’s use handle to move through this tokenized table and extract individual cell’s Label, Type (integer, real, etc.), and value.

Argument.

int NServer_DbdictBuildTable

( char *GrpName, char *DbdictInputString, INTEGER *handle, INTEGER *Ncols, INTEGER *Nrows, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

DbdictInputString INPUT String containing the DBDICT input request. Max size = 1024 characters.

handle OUTPUT This table’s handle.

=0 : table not built

>0 : handle ID

Ncols OUTPUT Number of columns (attributes) in this table.

Nrows OUTPUT Number of rows in this table.

ReturnCode OUTPUT Return Code

=0 ; OK

=1 ; FORMAT clause found in DbdictInputString

=2; DBDICT syntax error.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 87: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

79CHAPTER 4Database Features and APIs

Notes.

1. The DBDICT FORMAT clause specification cannot be used in the DbdictInputString.

2. See MSC.Nastran Quick Reference Guide DBDICT documentation for DbdictInputString options.

Page 88: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

80

NServer_DbdictGetLabelAndType- Retrieve a Column’s Label and Type

From FORTRAN:

CALL NSDBLAB(...)

From C:

Purpose. Returns a column’s label and type data for a NServer_DbdictBuildTable table.

Arguments.

int NServer_DbdictGetLabelAndType

( INTEGER Handle, INTEGER ColumnNumber, char *Label, INTEGER *LabelLength, INTEGER *Type, INTEGER *Iret)

Handle INPUT NServer_DbdictBuildTable Handle

ColumnNumber INPUT Labels Column (or attribute) number (>0))

Label OUTPUT Label for this ColumnNumber (Max size of 80 chars)

LabelLength OUTPUT Actual length of Label

Type OUTPUT Type code for this ColumnNumber. =1, integer=2, real single precision=3, character=4, real double precision=5, complex single precision=6, complex double precision=7, logical=15, real machine precision=16, complex machine precision=99, undefined

Iret OUTPUT Return status flag

=0; OK

=-1; invalid NServerDbdictBuildTable handle

>0; invalid ColumnNumber, Iret is the total number of columns available.

Function return OUTPUT Return status flag

Page 89: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

81CHAPTER 4Database Features and APIs

NServer_DbdictSetTableRowNumber - Position to a Row

From FORTRAN:

CALL NSDBROW(...)

From C:

Purpose. Position to a row in NServer_DbdictBuildTable.

Arguments.

int NServer_DbdictSetTableRowNumber

( INTEGER Handle, INTEGER RowNumber, INTEGER *Iret)

Handle INPUT NServer_DbdictBuildTable Handle

RowNumber INPUT Row number (>0))

Iret OUTPUT Return status flag

=0; OK

=-1; invalid NServerDbdictBuildTable handle

>0; invalid RowNumber, Iret is the total number of rows available.

Function return OUTPUT Return status flag

Page 90: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

82

NServer_DbdictGetAttributeValue - Extract Current Cell’s Data Within a NServer_DbdictBuildTable Table

From FORTRAN:

CALL NSDBAVA(...)

From C:

Purpose. Extract NServer_DbdictBuildTable Table cell’s value and type.

Arguments.

int NServer_DbdictGetAttributeValue

(INTEGER Handle, char *ValueString, INTEGER *ValueLeng, INTEGER *Type, INTEGER *Iret)

Handle INPUT NServer_DbdictBuildTable Handle

ValueString OUTPUT Value. (80 char max)

ValueLeng OUTPUT Actual length of ValueString.

Type OUTPUT Type code.

Iret OUTPUT Return status flag

=0; OK

=-1; invalid NServerDbdictBuildTable handle

>0; at the end of a row Iret.

Function return OUTPUT Return status flag

Page 91: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

83CHAPTER 4Database Features and APIs

NServer_DbdictGetNextTableCell - Extract the Next Cell’s Data Within a NServer_DbdictBuildTable Table

From FORTRAN:

CALL NSDBXCE(...)

From C:

Purpose. Extract next column’s Label, Value and Type from NServer_DbdictBuildTable table.

Arguments.

int NServer_DbdictGetNextTableCell

( INTEGER Handle, char *Label, INTEGER *LabelLength, char *ValueString, INTEGER *ValueLeng, INTEGER *Type,INTEGER *Iret)

Handle INPUT NServer_DbdictBuildTable Handle

Label OUTPUT Label for this ColumnNumber (Max size of 80 chars)

LabelLength OUTPUT Actual length of Label

ValueString OUTPUT Value. (80 char max)

ValueLeng OUTPUT Actual length of ValueString.

Type OUTPUT Type code for this ColumnNumber.

Iret OUTPUT Return status flag

=0; OK

>0; at the end of a row Iret. The next call will start at the first column of the next row.

=-1; invalid NServerDbdictBuildTable handle

=-2; at the end of the table. The next call will return data at the first row, first column.

Function return OUTPUT Return status flag

Page 92: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

84

NServer_DbdictFreeTable - Frees NServer_DbdictBuildTable Table

From FORTRAN:

CALL NSDBFRE(...)

From C:

Purpose. Free’s memory for a given NServer_DbdictBuildTable.

Arguments.

Note.

If Handle > 0, free this handle.If Handle = -1, free all handles.

int NServer_DbdictFreeTable

( INTEGER Handle )

Handle INPUT NServer_DbdictBuildTable Handle

Page 93: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

85CHAPTER 4Database Features and APIs

NServer_GetDatablock - Retrieves the Datablocks Stored on the Database

From FORTRAN:

CALL NSDBFDB(...)

From C:

Purpose. To return all datablocks defined by the supplied Option.

Arguments

int NServer_GetDatablock

( char *GrpName, char * Option, char *DatablockList, INTEGER DatablockListMax, INTEGER * DatablockListLen, INTEGER * NumberOfDatablocks, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server

Communication

Option INPUT Datablock selection option

‘LOCAL’, ‘NDDL’, ‘BOTH’, ‘LOCALNC’, ‘NDDLNC’, ‘BOTHNC’, ‘LOCALALL’, ‘NDDLALL’, ‘ALL’

DatablockList OUTPUT String containing a list of datablocks defined by the given OPTION

DatablockListMax INPUT Available character length of DatablockList

DatablockListLen OUTPUT Character length used of DatablockList

NumberOfDatablocks OUTPUT Number of Datablocks in DatablockList

Iret OUTPUT Server function return code

0 = OK

1 = Insufficient Opencore to store requested Names (NumberOfDatablocks set to -(additional opencore needed))

2 = Insufficient String Length of DatablockList (DatablockListLen set to -(additional characters required))

3 = 1 + 2

4 = Invalid Option (immediate return)

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 94: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

86

Notes.

1. The string DatablockList is returned as a comma-delimited list with extraneous blanks removed.

2. If the value for DatablockListMax is insufficient to return the requested information, an Error Code is set and DatablockListLen is set to the negative of the additional space required.

3. The NDDL type datablocks are prefaced by (NDDL).

4. The NDDLNC type datablocks are prefaced by (NDDL-NC)

5. The LOCAL type datablocks are prefaced by (SUBDMAP_name).

6. THE LOCALNC type datablocks are prefaced by (SUBDMAP_name-NC).

7. When the LOCALNC option is used the SUBDMAP MAIN contains only multiple SCRATCH datablocks. These are represented by the name SCRATCH appended with an ‘*’ and a block count,

8. When the BOTH, BOTHNC, NDDLALL, LOCALALL, or ALL options are specified the order of output is:

(NDDL), (NDDL-NC), (SUBDMAP_name), (SUBDMAP_name-NC)

9. The options are:

a. LOCAL, local/scratch datablocks with content

b. NDDL, NDDL-defined datablocks with content

c. BOTH, both local/scratch and NDDL-defined with content

d. LOCALNC, local/scratch datablocks without content

e. NDDLNC, NDDL-defined datablocks without content

f. BOTHNC, both local/scratch and NDDL-defined without content

g. LOCALALL, all local/scratch datablocks with/without content, equivalent to LOCAL and LOCALNC

h. NDDLALL, all NDDL-defined datablocks with/without content, equivalent to NDDL and NDDLNC

i. ALL, all local/scratch and NDDL-defined with/without content, equivalent to LOCALALL and NDDLALL

Example.

Sample output with a limited number of datablocks follow. For these examples, assume that these are the only datablocks on the database. Note that certain options, particularly those including the NDDLNC and LOCALNC options, can generate a lot of information

Page 95: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

87CHAPTER 4Database Features and APIs

option NDDL

(NDDL),GEOM1,GEOM2

option LOCAL

(USERDMAP),I10X10

option BOTH

(NDDL),GEOM1,GEOM2,(USERDMAP),I10X10

option NDDLNC

(NDDL-NC),KGG,UL

option LOCALNC

(MAIN-NC),SCRATCH*10,(PREFACE-NC),GEOM1.0,GEOM1.1,GEOM2.0,GEOM2.1,(USERDMAP-NC),J10X10

option BOTHNC

(NDDL-NC),KGG,UL,(MAIN-NC),SCRATCH*10,(PREFACENC),GEOM1.0,GEOM1.1,GEOM2.0,GEOM2.1,(USERDMAP-NC),J10X10

option NDDLALL

(NDDL),GEOM1,GEOM2,(NDDL-NC),KGG,UL

option LOCALALL

(USERDMAP),I10X10,(MAIN-NC),SCRATCH*10,(PREFACE-NC),GEOM1.0,GEOM1.1,GEOM2.0,GEOM2.1,(USERDMAP-NC),J10X10

option ALL

(NDDL),GEOM1,GEOM2,(NDDL-NC),KGG,UL,(USERDMAP),I10X10,(MAIN-NC),SCRATCH*10,(PREFACE-NC),GEOM1.0,GEOM1.1,GEOM2.0,GEOM2.1,(USERDMAP-NC),J10X10

Page 96: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

88

NServer_GetDatablockForKey - Retrieves the Datablocks Defined by a Given KEY

From FORTRAN:

CALL NSDBFKY(...)

From C:

Purpose. To return all datablocks defined given the supplied KEY

Arguments

int NServer_GetDatablockForKey

( char *GrpName, INTEGER KeyNumber, char *DatablockList, INTEGER DatablockListMax, INTEGER * DatablockListLen, INTEGER * NumberOfDatablocks, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

KeyNumber INPUT Integer KEY value

DatablockList OUTPUT String containing a list of datablocks defined by the given KeyNumber

DatablockListMax INPUT Maximum available character length of DatablockList

DatablockListLen OUTPUT Actual character length required by DatablockList

NumberOfDatablocks OUTPUT Number of Datablocks returned

Iret OUTPUT Server function return code

0 = OK

1 = Requested KEY not found (immediate return)

2 = Insufficient Opencore to store requested Names (NumberOfDatablocks set to -(additional opencore needed))

4 = Insufficient String Length of DatablockList (DatablockListLen set to -(additional characters required))

6 = 2 + 4

There are no return codes 3, 5 or 7

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 97: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

89CHAPTER 4Database Features and APIs

Notes

1. DatablockList is returned as a comma-delimited list with extraneous blanks removed.

2. If the KeyNumber is undefined, then DatablockList and DatablockListLen are set to blanks and zero, respectively.

3. If the value for DatablockListMax provides insufficient space to return the requested information, an Error Code is set and DatablockListLen is set to the negative of the additional space required.

Example

CHARACTER*(*) GrpName INTEGER KeyNumber INTEGER DBLMax, DatablockListMax PARAMETER( DBLMax = 1024 ) CHARACTER*(DBLMax) DatablockList INTEGER DatablockListLen, NumberOfDatablocks INTEGER ReturnCode, Error

DatablockListMax = DBLMax KeyNumber = 680

CALL NSDBFKY( GrpName, KeyNumber, DatablockList *, DatablockListMax, DatablockListLen *, NumberOfDatablocks, ReturnCode *, Error )

OUTPUTS

DatablockList

AGG,ETT,GEOM3S,SLT

DatablockListLen

18

NumberOfDatablocks

4

ReturnCode

0 KeyNumber = 600

CALL NSDBFKY( GrpName, KeyNumber, DatablockList *, DatablockListMax, DatablockListLen *, NumberOfDatablocks, ReturnCode *, Error )

Page 98: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

90

OUTPUTS:

DatablockList

<null>

DatablockListLen

0

NumberOfDatablocks

0

ReturnCode

1 (i.e., KeyNumber is not defined)

Page 99: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

91CHAPTER 4Database Features and APIs

NServer_GetDatablockForPathName - Retrieves the Datablocks Defined by a Given Path Name

From FORTRAN:

CALL NSDBFPN(...)

From C:

Purpose. To return all datablocks defined given the supplied Path Name

Arguments.

int NServer_GetDatablockForPathName

(char *GrpName, char *PathName, char *DatablockList, INTEGER DatablockListMax, INTEGER * DatablockListLen, INTEGER * NumberOfDatablocks, INTEGER *Iret, INTEGER *Error)

GrpName INPUT A unique identifier for Client/Server Communication

PathName INPUT String containing the name of an NDDL-defined path

DatablockList OUTPUT String containing a list of datablocks defined by the given Path Name

DatablockListMax INPUT Available character length of DatablockList string

DatablockListLen OUTPUT Actual character length of returned DatablockList string

NumberOfDatablocks OUTPUT Number of datablocks listed in DatablockList

Iret OUTPUT Server function return code

0 = OK

1 = Equivalent PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Names (NumberOfDatablocks set to -(additional opencore needed))

4 = Insufficient String Length of DatablockList (DatablockListLen set to -(additional characters required))

6 = 2 + 4

8 = PathName not found (immediate return)

There are no return codes 3, 5, 7, or 9-15

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 100: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

92

Notes.

1. DatablockList is returned as a comma-delimited list with extraneous blanks removed.

2. If the PathName is undefined, then the DatablockList and DatablockListLen are set to blanks and zero, respectively.

3. If the value for DatablockListMax provides insufficient space to return the requested information, an Error Code is set and DatablockListLen is set to the negative of the additional space required.

4. Functional equivalent of NServer_GetDatablockForPathPtr using PathName as input instead of PathPtr.

5. Path Names are a maximum eight characters in length. They rarely change once established.

6. The PathName executive table was introduced in version 2001 to allow for version-independent methods of accessing Path related database dictionary information.

7. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example. .

CHARACTER*(*) GrpName CHARACTER*8 PathName INTEGER DBLMax, DatablockListMax PARAMETER( DBLMax = 1024 ) CHARACTER*(DBLMax) DatablockList INTEGER DatablockListLen, NumberOfDatablocks INTEGER ReturnCode, Error

DatablockListMax = DBLMax PathName = 'PEIDI'

CALL NSDBFPN( GrpName, PathName, DatablockList *, DatablockListMax, DatablockListLen *, NumberOfDatablocks, ReturnCode *, Error )

OUTPUTS:

DatablockList

BGPDTS,CSTMS,DITID,DRG,ECTS,EPTS,EQEXINS,EST,GEOM1QS,GEOM1S, GEOM2S,GEOM4S,GEOM4QS,GPECT,GPLS,GPSNTS,MATPOOLS,PCOMPTS, SGPDTS,SILS,VAQ,VELEM,VGFD,VGFS

Page 101: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

93CHAPTER 4Database Features and APIs

DatablockListLen

148

NumberOfDatablocks

24

ReturnCode

0

Page 102: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

94

NServer_GetDatablockForPathPtr - Retrieves the Datablocks Defined by a Given Path Pointer

From FORTRAN:

CALL NSDBFPP(...)

From C:

Purpose. To return all datablocks defined given the supplied Path Pointer

Arguments

int NServer_GetDatablockForPathPtr

( char *GrpName, INTEGER PathPtr, char *DatablockList,INTEGER DatablockListMax, INTEGER * DatablockListLen, INTEGER * NumberOfDatablocks, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

PathPtr INPUT Integer Path Pointer of an NDDL-defined path

DatablockList OUTPUT String containing a list of datablocks defined by the given Path Name

DatablockListMax INPUT Available character length of DatablockList string

DatablockListLen OUTPUT Actual character length of returned DatablockList string

NumberOfDatablocks OUTPUT Number of datablocks listed in DatablockList

Iret OUTPUT Server function return code

0 = OK

1 = PathPtr not found (immediate return)

2 = Insufficient Opencore to store requested Names (NumberOfDatablocks set to -(additional opencore needed))

4 = Insufficient String Length of DatablockList (DatablockListLen set to -(additional characters required))

6 = 2 + 4

There are no return codes 3, 5, or 7

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 103: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

95CHAPTER 4Database Features and APIs

Notes

1. DatablockList is returned as a comma-delimited list with extraneous blanks removed.

2. If the PathName is undefined, then the DatablockList and DatablockListLen are set to blanks and zero, respectively.

3. If the value for DatablockListMax provides insufficient space to return the requested information, an Error Code is set and DatablockListLen is set to the negative of the additional space required.

4. Functional equivalent of NServer_GetDatablockForPathName using PathPtr as input instead of PathName.

5. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

6. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

Example. .

CHARACTER*(*) GrpName INTEGER PathPtr INTEGER DBLMax, DatablockListMax PARAMETER( DBLMax = 1024 ) CHARACTER*(DBLMax) DatablockList INTEGER DatablockListLen, NumberOfDatablocks INTEGER ReturnCode, Error

DatablockListMax = DBLMax PathPtr = 1845

CALL NSDBFPP( GrpName, PathPtr, DatablockList *, DatablockListMax, DatablockListLen *, NumberOfDatablocks, ReturnCode *, Error )

OUTPUTS:

DatablockList

BGPDTS,CSTMS,DITID,DRG,ECTS,EPTS,EQEXINS,EST,GEOM1QS,GEOM1S, GEOM2S,GEOM4S,GEOM4QS,GPECT,GPLS,GPSNTS,MATPOOLS,PCOMPTS, SGPDTS,SILS,VAQ,VELEM,VGFD,VGFS

DatablockListLen

148

NumberOfDatablocks

24

Page 104: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

96

NServer_GetDatablockKeys - Retrieves the KEYS Associated With a Given Datablock

From FORTRAN:

CALL NSDBKEY(...)

From C:

Purpose. To return the KEY values associated with the requested datablock family.

Arguments.

Notes.

1. If a datablock has more keys associated with it then MaxKeys, then MaxKeys number of keys will be returned in KeyNumbers and NumKeys will be set to (MaxKeys - actual number of keys).

int NServer_GetDatablockKeys

( char *GrpName, char *DatablockName, INTEGER *KeyNumbers, INTEGER MaxKeys, INTEGER *NumKeys, INTEGER *Iret,INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

DatablockName INPUT String containing the name of a datablock

KeyNumbers OUTPUT Integer array of KEYs associated with the supplied Datablock Name

MaxKeys INPUT Maximum length of KeyNumbers

NumKeys OUTPUT Number of KEYs returned

Iret OUTPUT Server function return code

0 = OK

1 = Requested Datablock not found (immediate return)

2 = Insufficient Opencore to store requested Keys (NumKeys set to -(additional opencore needed))

4 = Insufficient Integer Array Declaration for KeyNumbers (NumKeys set to -(additional wordss required))

6 = 2 + 4 (NumKeys set as in 4)

There are no return codes 3, 5 or 7

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 105: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

97CHAPTER 4Database Features and APIs

2. If the datablock does not exist, the first element of KeyNumbers and NumKeys are set to zero.

Example. .

CHARACTER*(*) GrpName CHARACTER*8 DatablockName INTEGER MKeys, MaxKeys PARAMETER( MKeys = 1024 ) INTEGER KeyNumbers(MKeys) INTEGER NumKeys, ReturnCode, Error

MaxKeys = MKEYS DatablockName = 'GEOM2S'

CALL NSDBKEY( GrpName, DatablockName, KeyNumbers, MaxKeys *, NumKeys, ReturnCode, Error )

OUTPUTS:

KeyNumbers

675 679

NumKeys

2

Page 106: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

98

NServer_GetDatablockPathName - Retrieves the Path Name for a Given Datablock

From FORTRAN:

CALL NSDBPNM(...)

From C:

Purpose. To return the Path Name of the requested datablock.

Arguments.

Notes.

1. If the DatablockName is undefined, then the PathName and PathNameLen are set to “N/A” and zero, respectively.

2. Functional equivalent of NServer_GetDatablockPathPtr using PathName as input instead of PathPtr.

3. Path Names are a maximum eight characters in length. They rarely change once established.

int NServer_GetDatablockPathName

( char *GrpName, char *DatablockName, char *PathName, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

DatablockName INPUT String containing the name of a datablock

PathName OUTPUT String containing the Path Name of the supplied Datablock Name

Iret OUTPUT Server function return code

0 = OK

1 = Requested Datablock not found (immediate return)

2 = PathName not found

In both cases, PathName is set to "N/A".

Note: return 2 may indicate that the PathName Table does not exist on the current database.

There is no return code 3.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 107: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

99CHAPTER 4Database Features and APIs

4. The PathName executive table was introduced in version 2001 to allow for version independent methods of accessing Path related database dictionary information.

5. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example.

CHARACTER*(*) GrpName CHARACTER*8 DatablockName, PathName INTEGER ReturnCode, Error

DatablockName = 'BGPDTS'

CALL NSDBPNM( GrpName, DatablockName, PathName,ReturnCode *, Error )

OUTPUT:

PathName

PEIDI

Page 108: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

100

NServer_GetDatablockPathPtr - Retrieves the Path Pointer for a Given Datablock

From FORTRAN:

CALL NSDBPPT(...)

From C:

Purpose. To return the Path Pointer of the requested datablock.

Arguments

Notes

1. If the DatablockName is undefined, then the PathPtr and PathNameLen are set to zero.

2. Functional equivalent of NServer_GetDatablockPathName using PathPtr as input instead of PathName.

3. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

4. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

int NServer_GetDatablockPathPtr

( char *GrpName, char *DatablockName, INTEGER *PathPtr, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

DatablockName INPUT String containing the name of a Datablock

PathPtr OUTPUT Integer Path Pointer of the supplied Datablock Name

Iret OUTPUT Server function return code

0 = OK

1 = Requested Datablock not found (immediate return) PathPtr is set to zero.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 109: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

101CHAPTER 4Database Features and APIs

Example

CHARACTER*(*) GrpName CHARACTER*8 DatablockName INTEGER PathPtr, ReturnCode, Error

DatablockName = 'BGPDTS'

CALL NSDBPPT( GrpName, DatablockName, PathPtr, ReturnCode *, Error )

OUTPUT:

PathPtr

1845

Page 110: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

102

NServer_GetKeyPathName - Retrieves the Path Name Associated with a Given KEY

From FORTRAN:CALL NSKYPTH(...)

From C:

Purpose. To return the general Path Name associated with a specific KEY.

Arguments.

Notes.

1. If the KeyNumber is undefined, then PathName and PathNameLen are set to “N/A” and zero, respectively.

2. Functional equivalent of NServer_GetKeyPathPtr returning PathName as output instead of PathPtr.

3. Path Names are a maximum eight characters in length. They rarely change once established.

int NServer_GetKeyPathName

( char *GrpName, INTEGER KeyNumber, char * PathName, INTEGER * Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

KeyNumber INPUT Integer KEY value

PathName OUTPUT String containing an NDDL-defined Path Name

Iret OUTPUT Server function return code

0 = OK

1 = Requested Key not found (immediate return)

2 = PathName not found

In both cases, PathName is set to "N/A".

Note: return 2 may indicate that the PathName Table does not exist on the current database

There is no return code 3.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 111: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

103CHAPTER 4Database Features and APIs

4. The PathName executive table was introduced in version 2001 to allow for version independent methods of accessing Path related database dictionary information.

5. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example. .

CHARACTER*(*) GrpName INTEGER KeyNumber CHARACTER*8 PathName INTEGER ReturnCode, Error

KeyNumber = 674

CALL NSKYPTH( GrpName, KeyNumber, PathName, ReturnCode *, Error )

OUTPUT:

PathName

IFPIP

Page 112: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

104

NServer_GetKeyPathPtr - Retrieves the Path Pointer Associated with a Given KEY

From FORTRAN:

CALL NSKYPTP(...)

From C:

Purpose. To return the general Path Pointer associated with a specific KEY.

Arguments.

Notes.

1. If the KeyNumber is undefined, then PathName and PathNameLen are set to “N/A” and zero, respectively.

2. Functional equivalent of NServer_GetKeyPathName returning PathPtr as output instead of PathName.

3. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

4. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

int NServer_GetKeyPathPtr

( char *GrpName, INTEGER KeyNumber, INTEGER * PathPtr, INTEGER * Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

KeyNumber INPUT Integer KEY value

PathPtr OUTPUT Integer containing an NDDL-defined equivalent Path Pointer

Iret OUTPUT Server function return code

0 = OK

1 = Requested Key not found (immediate return) PathPtr is set to zero.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 113: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

105CHAPTER 4Database Features and APIs

Example. .

CHARACTER*(*) GrpName INTEGER KeyNumber, PathPtr INTEGER ReturnCode, Error

KeyNumber = 674

CALL NSKYPTP( GrpName, KeyNumber, PathPtr, ReturnCode *, Error )

OUTPUT:

PathPtr

987

Page 114: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

106

NServer_GetKeyQualifiers - Retrieves the Qualifier Information Pertaining to the Given Key

From FORTRAN:

CALL NSKEYQU(...)

From C:

Purpose. To return the qualifier information for any given KEY value.

Arguments.

int NServer_GetKeyQualifiers

( char *GrpName, INTEGER KeyNumber, char * QualifierTable, INTEGER QualifierTableMax, INTEGER * QualifierTableLen, INTEGER * NumberOfQualifiers, INTEGER * Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

KeyNumber INPUT Integer KEY number

QualifierTable OUTPUT String containing a comma-delimited list of the qualifier information defining the given KEY

QualifierTableMax INPUT Maximum available character length of QualifierTable string

QualifierTableLen OUTPUT Actual character length of returned QualifierTable string

NumberOfQualifiers OUTPUT Number of Qualifiers defined in the string QualifierTable.

Iret OUTPUT Server function return code

0 = OK

1 = Requested KEY not found (immediate return)

2 = Insufficient Opencore to store requested Keys (NumberOfQualifiers set to -(additional opencore needed)) SFM 1139 generated by QUASEA subroutine (immediate return)

4 = Insufficient String Length of QualifierTable (QualifierTableLen set to -(additional characters required))

There are no return codes 3 or 5-7.

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 115: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

107CHAPTER 4Database Features and APIs

Notes.

1. Under the current implementation, the maximum character length of a Qualifier Name is eight characters.

2. QualifierTable is returned as a comma- and semicolon-delimited list with extraneous blanks removed of the form: QualiferName,QualifierType,QualifierValue;

3. QualifierType is returned as one of 1 (integer), 2 (real single precision), or 3 (character).

4. Character values are returned enclosed in single quotes

5. The NumberOfQualifiers is always the actual number of Qualifiers defining the specified KEY.

6. If the KeyNumber is undefined, then QualifierTable is set to blanks, and QualifierTableLen and NumberOfQualifiers are set to zero.

7. If the value for QualifierTableMax provides insufficient space to return the requested information, an Error Code is set and QualifierTableLen is set to the negative of the additional space required.

Example. .

CHARACTER*(*) GrpName INTEGER KeyNumber INTEGER QTMax, QualifierTableMax PARAMETER( QTMax = 1024 ) CHARACTER*(QTMax) QualifierTable INTEGER NumberOfQualifiers INTEGER ReturnCode, Error

QualifierTableMax = QTMax KeyNumber = 672

CALL NSKEYQU( GrpName, KeyNumber, QualifierTable *, QualifierTableMax, QualifierTableLen *, NumberOfQualifiers, ReturnCode, Error )

OUTPUTS:

QualifierTable

AUXMID,1,0;DESITER,1,0;HIGHQUAL,1,0;DESINC,1,0;DISCRETE,7,FALSE;

Page 116: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

108

QualifierTableLen

64

NumberOfQualifiers

5

Page 117: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

109CHAPTER 4Database Features and APIs

NServer_GetPathNameKeys - Retrieves the Key Values Associated with a Given Path Name

From FORTRAN:

CALL NSPTHKY(...)

From C:

Purpose. To return all specific KEY values associated with a given Path Name.

Arguments.

Notes.

1. If the PathName requested is undefined, then the first element of KeyList and NumKeys are both set to zero.

int NServer_GetPathNameKeys

( char *GrpName, char *PathName, INTEGER * KeyList, INTEGER MaxKeys, INTEGER * NumKeys, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

PathName INPUT String containing an NDDL-defined Path Name

KeyList OUTPUT Integer array of KEYS associated with the supplied Path Name

MaxKeys INPUT Maximum size of KeyList array

NumKeys OUTPUT Number of KEYS returned in KeyList

Iret OUTPUT Server function return code

0 = OK

1 = Equivalent PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Keys (NumKeys set to -(additional opencore needed))

4 = Insufficient Integer Array Declaration for KeyList (NumKeys to -(additional words required))

6 = 2 + 4 (NumKeys set as in 4)

8 = PathName not found (immediate return)

There are no return codes 3, 5, 7, or 9-15

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 118: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

110

2. If the PathName requested is defined, but has no specific Keys associated with it, then the first element of KeyList is set to zero and NumKeys is set to zero.

3. Functional equivalent of NServer_GetPathPtrKeys using PathName as input instead of PathPtr.

4. Path Names are a maximum eight characters in length. They rarely change once established.

5. The PathName executive table was introduced in version 2001 to allow for version independent methods of accessing Path related database dictionary information.

6. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example.

CHARACTER*(*) GrpName CHARACTER*8 PathName INTEGER MKeys, MaxKeys PARAMETER( MKeys = 1024 ) INTEGER KeyList(MKeys) INTEGER NumKeys INTEGER ReturnCode, Error

MaxKeys = MKeys PathName = 'PEIDI'

CALL NSPTHKY( GrpName, PathName, KeyList, MaxKeys, NumKeys *, ReturnCode, Error )

OUTPUTS:

KeyList

675 679

NumKeys

2

Page 119: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

111CHAPTER 4Database Features and APIs

NServer_GetPathPtrKeys - Retrieves the Key Values Associated with a Given Path Pointer

From FORTRAN:

CALL NSPTPKY(...)

From C:

Purpose. To return all specific KEY values associated with a given Path Pointer.

Arguments.

Notes.

1. If the PathPtr requested is undefined, then the first element of KeyList and NumKeys are both set to zero.

int NServer_GetPathPtrKeys

( char *GrpName, INTEGER PathPtr, INTEGER * KeyList, INTEGER MaxKeys, INTEGER * NumKeys, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server communication

PathPtr INPUT Integer Path Pointer of an NDDL-defined Path

KeyList OUTPUT Integer array of KEYS associated with the supplied Path Name

MaxKeys INPUT Maximum size of KeyList array

NumKeys OUTPUT Number of KEYS returned in KeyList

Iret OUTPUT Server function return code

0 = OK

1 = PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Keys (NumKeys set to -(additional opencore needed))

4 = Insufficient Integer Array Declaration for KeyList (NumKeys to -(additional words required))

6 = 2 + 4 (NumKeys set as in 4)

There are no return codes 3, 5, or 7

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 120: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

112

2. If the PathPtr requested is defined, but has no specific Keys associated with it, then the first element of KeyList is set to zero and NumKeys is set to zero.

3. Functional equivalent of NServer_GetPathNameKeys using PathPtr as input instead of PathName.

4. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

5. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

Example.

CHARACTER*(*) GrpName INTEGER PathPtr INTEGER MKeys, MaxKeys PARAMETER( MKeys = 1024 ) INTEGER KeyList(MKeys) INTEGER NumKeys INTEGER ReturnCode, Error

MaxKeys = MKeys PathPtr = 1845

CALL NSPTPKY( GrpName, PathPtr, KeyList, MaxKeys, NumKeys *, ReturnCode, Error )

OUTPUTS:

KeyList

675 679

NumKeys

2

Page 121: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

113CHAPTER 4Database Features and APIs

NServer_GetPathNameQualifiers - Retrieves the Qualifier Names Defining a Given Path Name

From FORTRAN:

CALL NSPTHQU(...)

From C:

Purpose. To return the qualifier names associated with a given Path Name.

Arguments.

int NServer_GetPathNameQualifiers

( char *GrpName, char *PathName, char * QualifierList, INTEGER QualifierListMax, INTEGER *QualifierListLen, INTEGER * NumberOfQualifiers, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

PathName INPUT String containing the name of an NDDL-defined path

QualifierList OUTPUT String containing a list of the qualifier names defining the given Path Name

QualifierListMax INPUT Maximum available character-length of QualifierList string

QualifierListLen OUTPUT Used character-length of QualifierList string

NumberOfQualifiers OUTPUT Number of Qualifiers defined in the QualifierList

Iret OUTPUT Server function return code

0 = OK

1 = Equivalent PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Qualifier Table (NumberOfQualifiers set to -(additional opencore needed)) SFM 1139 generated by QUANAM subroutine (immediate return)

4 = Insufficient String Length of QualifierList (QualifierListLen set to -(additional characters required))

8 = PathName not found (immediate return)

There are no return codes 3, 5, 6, 7, or 9-15

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 122: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

114

Notes.

1. QualifierList is a comma-delimited list with extraneous blanks removed.2. The NumberOfQualifiers is always the actual number of Qualifiers defining

the specified KEY.3. If the PathName is undefined, then QualifierList is set to blanks, and

QualifierListLen and NumberOfQualifiers are set to zero.4. If the value for QualifierListMax provides insufficient space to return the

requested information, an Error Code is set and QualifierListLen is set to the negative of the additional space required.

5. Functional equivalent of NServer_GetPathPtrQualifiers using PathName as input instead of PathPtr.

6. Path Names are a maximum eight characters in length. They rarely change once established.

7. The PathName executive table was introduced in version 2001 to allow for version independent methods of accessing Path related database dictionary information.

8. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example.

CHARACTER*(*) GrpName CHARACTER*8 PathName INTEGER QLMax, QualifierListMax PARAMETER( QLMax = 1024 ) CHARACTER*(QLMax) QualifierList INTEGER QualifierListLen, NumberOfQualifiers INTEGER ReturnCode, Error

QualifierListMax = QLMax PathName = 'PEIDI'

CALL NSPTHQU( GrpName, PathName, QualifierList *, QualifierListMax, QualifierListLen *, NumberOfQualifiers, ReturnCode *, Error )

OUTPUTS:

QualifierList

PEID,DESITER,PVALID,APRCH,HIGHQUAL,AUXMID,DESINC,DISCRETE

QualifierListLen

57

NumberOfQualifiers

8

Page 123: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

115CHAPTER 4Database Features and APIs

NServer_PathPtrQualifiers - Retrieves the Qualifier Names Defining a Given Path Pointer

From FORTRAN:

CALL NSPTPQU(...)

From C:

Purpose. To return the qualifier names associated with a given Path Pointer.

Arguments.

int NServer_PathPtrQualifiers

( char *GrpName, INTEGER PathPtr, char * QualifierList, INTEGER QualifierListMax, INTEGER *QualifierListLen, INTEGER * NumberOfQualifiers, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

PathPtr INPUT Integer Path Pointer of an NDDL-defined path

QualifierList OUTPUT String containing a list of the qualifier names defining the given Path Name

QualifierListMax INPUT Maximum available character-length of QualifierList string

QualifierListLen OUTPUT Used character-length of QualifierList string

NumberOfQualifiers OUTPUT Number of Qualifiers defined in the QualifierList

Iret OUTPUT Server function return code

0 = OK

1 = PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Qualifier Table (NumberOfQualifiers set to -(additional opencore needed)) SFM 1139 generated by QUANAM subroutine (immediate return)

4 = Insufficient String Length of QualifierList (QualifierListLen set to -(additional characters required))

There are no return codes 3, 5, 6, or 7

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 124: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

116

Notes

1. QualifierList is a comma-delimited list with extraneous blanks removed.

2. The NumberOfQualifiers is always the actual number of Qualifiers defining the specified KEY.

3. If the PathPtr is undefined, then QualifierList is set to blanks, and QualifierListLen and NumberOfQualifiers are set to zero.

4. If the value for QualifierListMax provides insufficient space to return the requested information, an Error Code is set and QualifierListLen is set to the negative of the additional space required.

5. Functional equivalent of NServer_GetPathNameQualifiers using PathPtr as input instead of PathName.

6. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

7. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

Example

CHARACTER*(*) GrpName INTEGER PathPtr INTEGER QLMax, QualifierListMax PARAMETER( QLMax = 1024 ) CHARACTER*(QLMax) QualifierList INTEGER QualifierListLen, NumberOfQualifiers INTEGER ReturnCode, Error

QualifierListMax = QLMax PathPtr = 1845

CALL NSPTPQU( GrpName, PathPtr, QualifierList *, QualifierListMax, QualifierListLen *, NumberOfQualifiers, ReturnCode *, Error )

OUTPUTS:

QualifierList

PEID,DESITER,PVALID,APRCH,HIGHQUAL,AUXMID,DESINC,DISCRETE

QualifierListLen

57

NumberOfQualifiers

8

Page 125: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

117CHAPTER 4Database Features and APIs

NServer_PathNameQualifierDefaults - Retrieves the Default Qualifier Information Defining a Given Path Name

From FORTRAN:

CALL NSPTHQD(...)

From C:

Purpose. To return the qualifier names associated with a given Path Name.

Arguments.

int NServer_PathNameQualifierDefaults

( char *GrpName, char *PathName, char * QualifierDefTable, INTEGER QualifierDefTableMax, INTEGER * QualifierDefTableLen, INTEGER * NumberOfQualifiers, INTEGER * Return Code, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

PathName INPUT String containing the name of an NDDL-defined path

QualifierDefTable OUTPUT String containing a list of the qualifier default information defining the given Path Name

QualifierDefTableMax INPUT Maximum available character-length of QualifierDefTable string

QualifierDefTableLen OUTPUT Used character-length of QualifierDefTable string

NumberOfQualifiers OUTPUT Number of Qualifiers defined in the QualifierDefTable string

Iret OUTPUT Server function return code

0 = OK

1 = Equivalent PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Qualifier Table (NumberOfQualifiers set to -(additional opencore needed)) SFM 1139 generated by QUADFT subroutine (immediate return)

4 = Insufficient String Length of QualifierDefTable (QualifierDefTableLen set to -(additional characters required))

8 = PathName not found (immediate return)

There are no return codes 3, 5, 6, 7, or 9-15

Page 126: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

118

Notes.

1. QualifierDefTable is returned as a comma- and semicolon-delimited list with extraneous blanks removed of the form: QualiferName,QualifierType,QualifierDefValue;

2. QualifierType is returned as one of 1 (integer), 2 (real single precision), or 3 (character).

3. Character values are returned enclosed in single quotes4. The NumberOfQualifiers is always the actual number of Qualifiers defining

the specified PathName.5. If the KeyNumber is undefined, then QualifierDefTable is set to blanks, and

QualifierDefTableLen and NumberOfQualifiers are set to zero.6. If the value for QualifierDefTableMax provides insufficient space to return

the requested information, an Error Code is set and QualifierDefTableLen is set to the negative of the additional space required.

7. Functional equivalent of NServer_GetPathPtrQualifierDefaults using PathName as input instead of PathPtr.

8. Path Names are a maximum eight characters in length. They rarely change once established.

9. The PathName executive table was introduced in version 2001 to allow for version independent methods of accessing Path related database dictionary information.

10. This is the recommended usage when accessing version 2001 or later MSC.Nastran databases.

Example

CHARACTER*(*) GrpName CHARACTER*8 PathName INTEGER QDTMax, QualifierDefTableMax PARAMETER( QDTMax = 1024 ) CHARACTER*(QDTMax) QualifierDefTable INTEGER QualifierDefTableLen, NumberOfQualifiers INTEGER ReturnCode, Error

QualifierDefTableMax = QDTMax PathName = 'PEIDI'

CALL NSPTHQD( GrpName, PathName, QualifierDefTable *, QualifierDefTableMax, QualifierDefTableLen *, NumberOfQualifiers, ReturnCode, Error )

Error OUTPUT Server return error flag

Function return OUTPUT Server return error flag

Page 127: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

119CHAPTER 4Database Features and APIs

OUTPUTS:

QualifierDefTable

PEID,1,-1;DESITER,1,0;PVALID,1,0;APRCH,3,' ';HIGHQUAL,1,0; AUXMID,1,0;DESINC,1,0;DISCRETE,7,FALSE;

QualifierDefTableLen

97

NumberOfQualifiers

8

Page 128: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

120

NServer_PathPtrQualifierDefaults - Retrieves the Default Qualifier Information Defining a Given Path Pointer

From FORTRAN:

CALL NSPTPQD(...)

From C:

Purpose. To return the qualifier names associated with a given Path Pointer.

Arguments.

int NServer_PathPtrQualifierDefaults

( char *GrpName, INTEGER PathPtr, char * QualifierDefTable, INTEGER QualifierDefTableMax, INTEGER * QualifierDefTableLen, INTEGER * NumberOfQualifiers, INTEGER * Return Code, INTEGER *Error )

GrpName INPUT A unique identifier for Client/Server Communication

PathPtr INPUT Integer value of the Path Pointer of an NDDL-defined path

QualifierDefTable OUTPUT String containing a list of the qualifier default information defining the given Path Name

QualifierDefTableMax INPUT Maximum available character-length of QualifierDefTable string

QualifierDefTableLen OUTPUT Used character-length of QualifierDefTable string

NumberOfQualifiers OUTPUT Number of Qualifiers defined in the QualifierDefTable string

Iret OUTPUT Server function return code

0 = OK

1 = PathPointer not found (immediate return)

2 = Insufficient Opencore to store requested Qualifier Table (NumberOfQualifiers set to -(additional opencore needed)) SFM 1139 generated by QUADFT subroutine (immediate return)

4 = Insufficient String Length of QualifierDefTable (QualifierDefTableLen set to -(additional characters required))

There are no return codes 3, 5, 6, or 7

Error OUTPUT Server return error flag

Page 129: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

121CHAPTER 4Database Features and APIs

Notes.

1. QualifierDefTable is returned as a comma- and semicolon-delimited list with extraneous blanks removed of the form: QualiferName,QualifierType,QualifierDefValue;

2. QualifierType is returned as one of 1 (integer), 2 (real single precision), or 3 (character).

3. Character values are returned enclosed in single quotes

4. The NumberOfQualifiers is always the actual number of Qualifiers defining the specified PathName.

5. If the KeyNumber is undefined, then QualifierDefTable is set to blanks, and QualifierDefTableLen and NumberOfQualifiers are set to zero.

6. If the value for QualifierDefTableMax provides insufficient space to return the requested information, an Error Code is set and QualifierDefTableLen is set to the negative of the additional space required.

7. Functional equivalent of NServer_GetPathNameQualifierDefaults using PathPtr as input instead of PathName.

8. Path Pointers are integer offset values. They frequently change not only between versions, but also within releases of the same version.

9. This is the required usage when accessing MSC.Nastran databases prior to version 2001.

Example.

CHARACTER*(*) GrpName INTEGER PathPtr INTEGER QDTMax, QualifierDefTableMax PARAMETER( QDTMax = 1024 ) CHARACTER*(QDTMax) QualifierDefTable INTEGER QualifierDefTableLen, NumberOfQualifiers INTEGER ReturnCode, Error

QualifierDefTableMax = QDTMax PathPtr = 1845

CALL NSPTPQD( GrpName, PathPtr, QualifierDefTable *, QualifierDefTableMax, QualifierDefTableLen *, NumberOfQualifiers, ReturnCode, Error )

Function return OUTPUT Server return error flag

Page 130: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

122

OUTPUTS:

QualifierDefTable

PEID,1,-1;DESITER,1,0;PVALID,1,0;APRCH,3,' ';HIGHQUAL,1,0; AUXMID,1,0;DESINC,1,0;DISCRETE,7,FALSE;

QualifierDefTableLen

97

NumberOfQualifiers

8

Page 131: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

The following GINO description is an excerpt from the User Modifiable MSC.Nastran User's Guide. It is included here since many of the basic Toolkit File I/O API's described in this section perform the same General Input/Output (GINO) functions as the corresponding I/O utilities used within MSC.Nastran—the primary difference being that the Toolkit API's interface with Gino from an external client program physically located outside the MSC.Nastran program.

CHAPTER

5 File I/O APIs

■ GINO

■ General I/O Utilities

Page 132: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

124

5.1 GINOGINO is a collection of Executive System subroutines that provides for all input and output operations within MSC.Nastran, except reading data from the resident system input file, writing data on the resident system output and punch files, writing plotter output, and transferring data to and from foreign programs. These latter operations are accomplished through FORTRAN formatted and unformatted read/write statements.

GINO acts as a buffer between the MSC.Nastran functional modules and the operating system of the computer. This design feature eliminates computer-dependent code from the functional modules which are, consequently, written mostly in FORTRAN. The use of computer-dependent code for the selection of the operating system routines to accomplish the actual input/output functions is isolated to a single routine within GINO.

All MSC.Nastran routines must use GINO to communicate with the database. They are thus isolated from the actual physical hardware and such concerns as blocking factors and device characteristics. In turn, the data written by GINO is readable by any MSC.Nastran routine. GINO enhances normal FORTRAN binary I/O by providing for end-of-file and end-of-record returns as well as partial record reads and writes.

GINO Calls

All GINO physical records are blocked to a constant size with a potential for multiple records per block or multiple blocks per record. Data blocks are written sequentially but read both sequentially (forward and backward) and with a keyed form of direct access. Since main memory is used as a scratch pad (no module may leave values in main memory), GINO-formatted data blocks form the bulk of the intermodule communications. MSC.Nastran performs input/output operations by making the following calls.

OPEN Initiates activity for a file unless the data block assigned to the file is purged, in which case an alternate return is given. A working storage area, for use by GINO (GINO buffer), is assigned (allocated) by the calling program, thus providing optimum allocation or storage by the calling program. This working storage area is reserved for use by GINO until activity on the file is terminated by a call to CLOSE (see CLOSE, below). See NServer_OpenDatablk page 127.

WRITE Writes a specified (by the calling program) number of words on a file. The block of words to be written may comprise an entire logical record or portion of a logical record. See NServer_WriteRecord page 148.

READ Returns to the calling program a number of words from the logical record at which the file is currently positioned as specified. READ may be used to transmit an entire logical record or portion of a logical record as specified by the calling program. See NServer_ReadRecord page 146.

Page 133: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

125CHAPTER 5File I/O APIs

Logical Records

The basic unit of I/O in MSC.Nastran is a logical record. The length of a logical record is completely variable and may range from zero words to an arbitrarily large number of words. For matrix data blocks, the convention was adopted that each column of the matrix would comprise one logical record. For data blocks containing tables, no rigid convention exists. Typically each logical record contains one table of a specific type.

Since logical record lengths are variable, but the length of records physically read or written is fixed, logic must be provided to accommodate this situation. This logic is provided in the GINO routine, which allows for the following cases:

• Multiple logical records per block

• Multiple blocks per logical record

The method by which physical input and output of blocks is accomplished by GINO is machine dependent. These implementation differences are transparent to the MSC.Nastran applications programmer (functional module writer).

GINO files are always written sequentially and generally read sequentially, although direct access reads are used in several key areas (EMA, DBMGR, and MPYAD).

GINO File Names

Internal GINO file numbers use the following conventions:

• input data blocks: 100 + position in the compiled DMAP.

• output data blocks: 200 + position in the DMAP entry.

• scratch data blocks: 301 through 300 + n where n = number of scratch data blocks as defined in an internal table called the Module Properties List (MPL).

For example, consider the following DMAP calling sequence for functional module XYZ:

The data blocks input to the module are A, B and C; the data blocks output from the module are D, E, F, and G. Note that internal scratch files are not mentioned in the DMAP calling sequence. The number of scratch files for a module is defined in the Module Property List (MPL) Executive table and is communicated to the Executive System.

CLOSE CLOSE terminates activity for a file. The file is repositioned to the load point if requested. See NServer_CloseDatablk page 129.

SKPREC Repositions the requested file one logical record forward or backward. See NServer_SkipRecord page 138.

XYZ A,B,C/D,E,F,G/$

Page 134: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

126

In order to read the input data block B, the GINO file number internal to XYZ is 102; in order to write data block D, the GINO file number is 201. The third of, say, five scratch data blocks is referenced by XYZ through the GINO file number 303.

Page 135: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

127CHAPTER 5File I/O APIs

5.2 General I/O Utilities

NServer_OpenDatablk - Open a Datablock (Matrix or Table)

From FORTRAN:

CALL NSOPNDB(...)

From C:

Purpose. Interface call to open a Datablock File from MSC.Nastran database, for read or write.

Arguments.

int NServer_OpenDatablk

( char *GrpName , INTEGER Filept, char R_or_W, char REW_NOREW, INTEGER Iret ,INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation API calls (see NServer_AllocDatablk and NServer_CreateDatablk).

R_or_W INPUT 'R' for Read or 'W' for Write Option

REW_NOREW INPUT 'Y' for Rewind or 'N' for No-Rewind option

Iret OUTPUT Non-Zero value indicates that file does not exist.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 136: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

128

NServer_GOpenDatablk - Open a Datablock (Table or Matrix)

Differs from NServer_OpenDatablk in the way it handles the header record (record 0)

From FORTRAN:

CALL NSGPNDB(...)

From C:

Purpose. Interface call to open a Datablock File from MSC.Nastran database:

• For read option: skip the header record 0 and position at record 1.

• For write option: generate a header record 0 and position at record 1.

Arguments.

Note.

Server will FATAL if the client program is trying to read from a file that does not exist. Use NServer_ReadTrailer to test whether a filept exists.

int NServer_GOpenDatablk

( char *GrpName , INTEGER Filept , char R_or_W , char REW_NOREW ,INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation

R_or_W INPUT 'R' for Read or 'W' for Write Option

REW_NOREW INPUT 'Y' for Rewind or 'N' for No-Rewind option

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 137: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

129CHAPTER 5File I/O APIs

NServer_CloseDatablk - Close a Datablock (table or matrix)

From FORTRAN:

CALL NSCLSDB(...)

From C:

Purpose. Interface call to close a Datablock.

Arguments.

int NServer_CloseDatablk

( char *GrpName , INTEGER Filept , char REW_NOREW , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation

REW_NOREW INPUT 'Y' for Rewind or 'N' for No-Rewind option

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 138: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

130

NServer_PrelocDatablk - Prepare a Datablock to be Accessed by NServer_LocateRecord

From FORTRAN:

CALL NSPRELO(…)

From C:

Purpose. Prepares a datablock for access by NServer_LocateRecord. It opens an IFP file and positions to first data record.

Arguments.

Note.

This interface, used to read IFP card data, is older than the Indexed APIs presented in Chapter 8. This API provides tools to read a group of cards but not individual cards.

Example. Demonstrates how to use …PrelocDatablk and…LocateDatablk to open a datablock (Geom2) and then position that datablock for "read" access at the beginning of the record PLOTEL.

int NServer_PrelocDatablk

( char *GrpName , INTEGER Filept , INTEGER *Retno , INTEGER *Error);

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT File handle of the datablock

Retno OUTPUT Return code of the preloc function

Error OUTPUT Return error code

Func. Ret. OUTPUT Server return error flag.

Page 139: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

131CHAPTER 5File I/O APIs

SUBROUTINE XDBGM2 (GRPNAM,LNBUF,IBUF, N P L T E L , I R C )CC This subroutine returns the number of PLOTEL entries found in GEOM2.CC Input GRPNAM ... Group Name of the ServerC LNBUF ... Length of Working ArrayC IBUF(*) ... Working ArrayC Output NPLTEL ... Number of PLOTEL entries in GEOM2C IRC ... Return Code: 0 Normal EndC 1 Errors EncounteredCCC ----------------------------------------------------------------------C CHARACTER*(*) GRPNAM LOGICAL XTLBIT INTEGER IBUF(*) INTEGER IPLTEL(2),ITRAIL(7)CC First 2 Header Words of PLOTEL Record DATA IPLTEL /5201, 52/CC IRC =0 NPLTEL=0C Initialize local I/O for this subroutine (non-Toolkit related) CALL QIOTRM ( I N , I O U T )CC Allocate GEOM2C CALL NSALLDB (GRPNAM,'DATABLK=GEOM2', I F I L P T , . N M A T C H , I E R A P I ) IF (IERAPI.NE.0) GO TO 910 IF (NMATCH.EQ.0) GO TO 999CC Check Trailer for Existence of PLOTEL RecordC CALL NSRDTRL (GRPNAM,IFILPT, I T R A I L , I E R A P I ) IF (IERAPI.NE.0) GO TO 911 IF (.NOT.XTLBIT(IPLTEL(2),ITRAIL(2))) GO TO 999CC Open GEOM2 (contains PLOTELs)C CALL NSPRELO (GRPNAM,IFILPT, I R E T , I E R A P I ) IF (IERAPI.NE.0.OR.IRET.NE.0) GO TO 912CC Locate PLOTEL RecordC CALL NSLOCAT (GRPNAM,IFILPT,IPLTEL, . I F L A G , I R E T , I E R A P I ) IF (IERAPI.NE.0) GO TO 913 IF (IRET.NE.0) GO TO 920

Page 140: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

132

CC Get Number of PLOTELsC NWORDS=0 2 CONTINUE CALL NSREADR (GRPNAM,IFILPT, I B U F ,LNBUF,0, . I E O R , N W , I E R A P I ) IF (IERAPI.NE.0) GO TO 913 NWORDS=NWORDS+NW IF (IEOR.EQ.0) GO TO 2 NPLTEL=NWORDS/3CC Close GEOM2C 990 CALL NSCLSDB (GRPNAM,IFILPT,'N', I E R A P I ) IF (IERAPI.EQ.0) GO TO 999C WRITE(IOUT,9100) IERAPI,'NSCLSDB' IRC=1 GO TO 999CC Error BranchC 910 WRITE(IOUT,9100) IERAPI,'NSALLDB' 9100 FORMAT(2X,'*E* XDBGM2: API Error Code ',I10,' from ',A7) IRC=1 GO TO 999C 911 WRITE(IOUT,9100) IERAPI,'NSRDTRL' IRC=1 GO TO 999C 912 WRITE(IOUT,9120) IERAPI,IRET 9120 FORMAT(2X,'*E* XDBGM2: API Error Code ',I10,' from NSPRELO'/ . 2X,' Result Code is ',I10) IRC=1 GO TO 990

C 913 WRITE(IOUT,9100) IERAPI,'NSLOCAT' IRC=1 GO TO 990C 914 WRITE(IOUT,9100) IERAPI,'NSREADR' IRC=1 GO TO 990C 920 WRITE(IOUT,9200) 9200 FORMAT(2X,'*E* XDBGM2: Datablock GEOM2 is corrupted') IRC=1 GO TO 990C 999 CONTINUE RETURN END

Page 141: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

133CHAPTER 5File I/O APIs

NServer_LocateRecord - Position an IFP File to the Requested Record

From FORTRAN:

CALL NSLOCAT(…)

From C:

Arguments.

Example: See NServer_PrelocDatablk example on page 130.

int NServer_LocateRecord

(char *GrpName, INTEGER Filept , INTEGER *Id , INTEGER *Flag , INTEGER *Retno , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT File Handle of the datablock.

Id INPUT 2-word IFP table locate-id of the record being requested.

Flag OUTPUT Return flag code of the locate function.

Retno OUTPUT Return code of the locate function.

Func. Ret. OUTPUT Server return error flag.

Page 142: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

134

NServer_InfoRecord - Get a table of NServer_FilposRecord Pointers and record sizes for a Datablock.

From FORTRAN:

CALL NSINFOR(...)

From C:

Purpose. Get a table containing the size and NServer_FilposRecord position for each record of a datablock.

Arguments.

int NServer_InfoRecord

( char *GrpName , INTEGER Filept , INTEGER *Nrec, INTEGER* Info, INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Nrec INPUT/OUTPUT

As input; Maximum Number of 3 word entries allowed in Info. As output; number of entries contained in Info.

Info OUTPUT A table containing 3-word entries of;

Word 1: size of record (words)

Words 2-3: NServer_FilposRecord position.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 143: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

135CHAPTER 5File I/O APIs

NServer_ReadTrailer - Read a Datablock Trailer Record

From FORTRAN:

CALL NSRDTRL(...)

From C:

Purpose. Interface call to Read the Trailer of a datablock.

Arguments.

Example: See NServer_PrelocDatablk example on page 130.

int NServer_ReadTrailer

( char *GrpNamerpName , INTEGER Filept , INTEGER *Trailer , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Trailer OUTPUT The return trailer (7 words). The first word of the trailer will be less than zero if Filept does not exist.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 144: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

136

NServer_ForwardRecord - Move to the next record (Table or Matrix Column)

From FORTRAN:

CALL NSFORWD(...)

From C:

Purpose. Move to the next record (table) or Column (matrix) of a datablock.

Arguments.

int NServer_ForwardRecord

( char *GrpName , INTEGER Filept , INTEGER *Iret,INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Iret OUTPUT Return Code.

= 0 OK

!=0 unable to move forward.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 145: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

137CHAPTER 5File I/O APIs

NServer_BackwardRecord - Move back a record (Table or Matrix Column)

From FORTRAN:

CALL NSBAKWD(...)

From C:

Purpose. Move to the beginning of the previous record (table) or Column (matrix) of a datablock.

Arguments.

int NServer_BackwardRecord

( char *GrpName , INTEGER Filept ,INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 146: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

138

NServer_SkipRecord - Skip a Record (Table or Matrix Column)

From FORTRAN:

CALL NSSKIPR(...)

From C:

Purpose. Interface call to skip records (table) or Column (matrix) of a datablock.

Arguments.

int NServer_SkipRecord

( char *GrpName , INTEGER Filept , INTEGER Nrec, INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Nrec INPUT Number of Records to be skipped

> 0 for forwards

< 0 for backwards

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 147: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

139CHAPTER 5File I/O APIs

NServer_ReadTrailerX - Read the Extended Trailer of a Datablock

From FORTRAN:

CALL NSRDTRX(...)

From C:

Purpose. Interface call that will return both the standard 7 word matrix trailer (see NServer_ReadTrailer) and the 7 word matrix trailer extension.

Arguments.

int NServer_ReadTrailerX

(char *GrpName, INTEGER Filept , INTEGER *TrailerX , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

TrailerX OUTPUT The return trailer (14 words).

(See the document "MSC.Nastran Datablocks and Dmap Modules" for a description of these trailer words.)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 148: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

140

NServer_SetMatrixTrailer - Make a Trailer Control Block for a Matrix DatablockFrom FORTRAN:

CALL NSMATRL(...)

From C:

Purpose. Interface call to make Trailer Control Block for a Matrix datablock.

Arguments.

Note. Forms the 7-word trailer from the given information.

int NServer_SetMatrixTrailer

INTEGER *Trailer , INTEGER Filept , INTEGER NumRow , INTEGER MatForm , INTEGER MatType , INTEGER *Error );

Trailer OUTPUT The return trailer (7 words).

Filept INPUT Datablock File handle from previous allocation or creation.

NumRow INPUT Number of row.

MatForm INPUT Form of Matrix

1: Square Matrix 2: Rectangular Matrix 3: Diagonal Matrix 4: Lower Triangle Matrix 5: Upper Triangle Matrix 6: Symmetric Matrix 7: Row Vector Matrix 8: Identity Matrix 9: Transformation matrix10: Cholesky Lower Triangle Factor11: Partial Lower Triangle Factor

MatType INPUT Type of Matrix

1: Real Single Precision2: Real Double Precision3: Real Complex Single Precision4: Real Complex Double Precision

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 149: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

141CHAPTER 5File I/O APIs

NServer_MakeTrailer - Make a Trailer Control Block for a Matrix Datablock

From FORTRAN:

CALL NSMKTRL(...)

From C:

Purpose. Interface call to make Trailer Control Block for a Matrix datablock.

Arguments.

int NServer_MakeTrailer

(char *GrpName , INTEGER *Trailer , INTEGER Filept , INTEGER NumRow , INTEGER MatForm , INTEGER MatType , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Trailer OUTPUT The return trailer (7 words).

Filept INPUT Datablock File handle from previous allocation or creation.

NumRow INPUT Number of row.

MatForm INPUT Form of Matrix

1: Square Matrix 2: Rectangular Matrix 3: Diagonal Matrix 4: Lower Triangle Matrix 5: Upper Triangle Matrix 6: Symmetric Matrix 7: Row Vector Matrix 8: Identity Matrix 9: Transformation matrix10: Cholesky Lower Triangle Factor11: Partial Lower Triangle Factor

MatType INPUT Type of Matrix

1: Real Single Precision2: Real Double Precision3: Real Complex Single Precision4: Real Complex Double Precision

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 150: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

142

NServer_WriteTrailer - Write the Trailer of a Datablock

From FORTRAN:

CALL NSWRTRL(...)

From C:

Purpose. Interface call to write the Trailer of a datablock (for both table and matrix).

Arguments.

int NServer_WriteTrailer

( char *GrpName , INTEGER Filept , INTEGER *Trailer , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Trailer INPUT The trailer (7 words)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 151: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

143CHAPTER 5File I/O APIs

NServer_FilposRecord - Position the Record to a Given Direct Access Index

From FORTRAN:

CALL NSFILPS

From C:

Purpose. Position the record to a given direct access index.

Arguments.

int NServer_FilposRecord

( char *GrpName, INTEGER Filept, INTEGER *Filpos, INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT File handle of the datablock.

Filpos INPUT 2-word integer of the index (output from NServer_SavposRecord).

Error INPUT Return error code.

Func. Ret. OUTPUT Server return error flag.

Page 152: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

144

NServer_SavposRecord - Save Direct Access Index of the Current Record

From FORTRAN:

CALL NSSVPOS

From C:

Purpose. Save direct access index for the beginning of the current record.

Arguments.

int NServer_SavposRecord

( char *GrpName, INTEGER Filept, INTEGER *Filpos, INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT The file handle for the datablock.

Filpos OUTPUT 2-word integer of the index.

Error OUTPUT Return error code.

Func. Ret. OUTPUT Server return error flag.

Page 153: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

CHAPTER

6 Table I/O APIs

■ Table APIs

Page 154: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

146

6.1 Table APIs

NServer_ReadRecord - Read a Record from a Datablock (table only)

From FORTRAN:

CALL NSREADR(...)

From C:

Purpose. Interface call to read a Record of a Table datablock.

Arguments.

int NServer_ReadRecord

( char *GrpName , INTEGER Filept , INTEGER *Record , INTEGER Nleng , INTEGER EOR, INTEGER *EORret, INTEGER *NWread , INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

Record OUTPUT A Buffer for data.

Nleng INPUT Requested Max size of INTEGER words to be read from Record.

EOR INPUT End of record control flag.

0 - No advance to next record after READ

1 - Advance to next record after READ

EORret OUTPUT 0 - Subsequent call to Nserver_ReadRecord for the logical record are expected.

1 - End-of-file encountered.

2 - End-of-logical Record encountered. The Current Call is the last call for the current record. The file will be positioned to the beginning of the next logical record before returning.

NWread OUTPUT Actual size of INTEGER words that have been read.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 155: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

147CHAPTER 6Table I/O APIs

Note. Reads the current record of a datablock. The returned data has mixed data types (i.e., integer, reals, etc.). Thus, the client application has to know the format of the data to unpack and correctly process it (see NServer_NDDLDesc).

Example. See NServer_ReadRecord example on page 150.

Page 156: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

148

NServer_WriteRecord - Write a Record of a Table Datablock

From FORTRAN:

CALL NSWRITE(...)

From C:

Purpose. Write a Record of a table datablock.

Arguments.

Note:

1. Do not use this API unless the client and server are binary compatible. Otherwise use NServer_AddRecTerm.

int NServer_WriteRecord

( char *GrpName , INTEGER Filept , INTEGER *Record , INTEGER Nleng , INTEGER EOR , INTEGER *Error )

GrpName INPUT An unique identifier for the Client/Server communication.

Filept INPUT Handle of the table datablock.

Record INPUT Contains the data to be written.

Nleng INPUT Number of words to be written.

EOR INPUT Write an End-Of-Record flag after this write operation.

0= Don’t write an EOR. Leave record at current position ready for additional calls to NServer_WriteRecord.

1=Write an EOR.

Error INPUT Return Error Status.

Func. Ret. OUTPUT Server return error flag.

Page 157: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

149CHAPTER 6Table I/O APIs

Example. The following function shows an example of “writing” and “reading” table datablocks.

void WriteTable ( char *GrpName )

{

char *CreateString={"DBCREATE DATABLK=ZUZR11 QUALS (ZNAME='AUPA') "};

int i,Filept,FileStat,Error;

int RecLen,EOR=1, EORret, RecNum; int Record[RECSIZE], Array[RECSIZE];

/* * Create a datablock to output data */ (void) NServer_CreateDatablk ( GrpName , CreateString , &Filept , &FileStat ,&Error );

(void) fprintf(stderr, " NServer_CreateDatablk CreateString=%s\n",CreateString); (void) fprintf(stderr, " Filept=%d FileStat=%d Error=%d\n",Filept,FileStat,Error);

if( !Filept || Error ) return;/* * Fill up record */ for (i=0 ; i<RECSIZE ; i++ ) Record[i]=i+1;

/* * Open datablock to write */ (void) NServer_GOpenDatablk( GrpName , Filept , 'W' , 'Y' , &Error );/* * Write to datablock */

fprintf(stderr, " Call NServer_WriteRecord for Group %s Filept=%d\n",GrpName,Filept); for (RecNum=0 ; RecNum<MAXREC ; RecNum++ ) { RecLen = RecNum+1;

(void) NServer_WriteRecord ( GrpName , Filept , Record , RecLen, EOR , &Error ); (void) fprintf( stderr," Write Record_Number %d Record_Length is %d\n",RecNum,RecLen); for( i=0,(void) fprintf( stderr," Write Data=") ; i < RecLen ; (void) fprintf( stderr," %d ",Record[i]) , i++ ); (void) fprintf( stderr,"\n"); }

Page 158: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

150

/* * Close datablock */ (void) NServer_CloseDatablk( GrpName , Filept , 'Y' , &Error );

/* * Reopen datablock to read back record by record then close it */ (void) NServer_GOpenDatablk( GrpName , Filept , 'R' , 'Y' , &Error );

fprintf(stderr, " Call NServer_ReadRecord for Group %s Filept=%d\n",GrpName,Filept);

for (RecNum=0 ; RecNum<MAXREC ; RecNum++ ) { (void) NServer_ReadRecord( GrpName , Filept , Array , RECSIZE , EOR ,&EORret, &RecLen , &Error ); (void) fprintf( stderr," Read Record_Number %d Record_Length is %d\n",RecNum,RecLen);

for( i=0,(void) fprintf( stderr," Read Data=") ; i < RecLen ; (void) fprintf( stderr," %d ",Array[i]) , i++ ); (void) fprintf( stderr,"\n"); }

(void) NServer_CloseDatablk( GrpName , Filept , 'Y' , &Error );

}

Page 159: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

151CHAPTER 6Table I/O APIs

NServer_AddRecTerm - Add Term(s) of a Record to a Table DataBlock

From FORTRAN:

CALL NSARTER (...)

From C:

Purpose. Add Term(s) of a Record to a Table DataBlock. This API is similar in function to NServer_WriteRecord. It’s use is preferred over NServer_WriteRecord for all programs where the client and server may not be binary compatible.

Arguments.

int NServer_AddRecTerm

( char *GrpName , INTEGER Filept , char *TermDescriptor , INTEGER NRepeat ,INTEGER *TermData , INTEGER *NTermAdd , INTEGER *NWordAdd , INTEGER EOR, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

Filept INPUT File Handler for reference of the DataBlock

TermDescriptor INPUT Buffer contains the description for term data

Types signature are identical to NDDL types:

I IntegerRS Real Single PrecisionCHAR4 Character 4RD Real Double PrecisionCS Complex Single PrecisionCD Complex Double PrecisionLOGICAL LogicalRX Real Machine PrecisionCX Complex Machine Precision

Comma or blank(s) can be used for delimiter.

NRepeat INPUT Number of repeated TermDescriptor

TermData INPUT Buffer contains the Record term data to add

Page 160: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

152

Application Notes.

1. DataBlock has to be pre-allocated via NServer_CreateDatablk.

2. DataBlock has to be open using option 'A' (Add) in

NServer_OpenDatablk or NServer_GOpenDatablk.

3. After adding all entries, DataBlock should be closed via

NServer_CloseDatablk and trailer should be written via

NServer_WriteTrailer.

4. DataBlock's data format is not limited to NDDL typed data, for example, apply your own data description for ZUZR DataBlocks.

Example of C-program Application Usage.

A basic format descriptor for GRID cards of GEOM1 table:

"2I 3RX 3I", which applied to a data structure of 8 terms of 11 words on double machine or 8 words on a single machine

To add 4 Grid cards to GEOM1 DataBlock:

NRepeat = 4;(void) NServer_AddRecTerm( GrpName, GEOM1Filept, "2I,3RX,3I", NRepeat, (INTEGER *)GRIDdatainp, &NTermAdd, &NWordAdd, EOR, &Error );

NTermAdd OUTPUT Number of Terms have been added in record

NWordAdd OUTPUT Number of Words have been added in record

EOR INPUT End of Record control flag

= 0: No advance to next record after adding data terms= 1: Advance to next record after adding data terms

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

Page 161: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

153CHAPTER 6Table I/O APIs

Alternatively, it can be coded as:

NRepeat = 1;(void) NServer_AddRecTerm( GrpName, GEOM1Filept, "4(2I,3RX,3I)", NRepeat, (INTEGER *)GRIDdatainp, &NTermAdd, &NWordAdd, EOR, &Error );

Page 162: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

154

NServer_GetRecTerm - Get Terms of a Record from a Table Datablock

From FORTRAN:

CALL NSGRTER (...)

From C:

Purpose. Get Term(s) of a Record from a Table DataBlock. This API is similar in function to NServer_ReadRecord. It’s use is preferred over NServer_ReadRecord for all programs where the client and server may not be binary compatible.

Arguments.

int NServer_GetRecTerm

( char *GrpName, INTEGER Filept,char *TermDescriptor, INTEGER NRepeat,INTEGER *TermData, INTEGER *NTermGet,INTEGER *NWordGet, INTEGER EOR, INTEGER *EORret, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

Filept INPUT File Handle for reference of the DataBlock

TermDescriptor INPUT Buffer contains the description for term data

Types signature are identical to NDDL types:

I IntegerRS Real Single PrecisionCHAR4 Character 4RD Real Double PrecisionCS Complex Single PrecisionCD Complex Double PrecisionLOGICAL LogicalRX Real Machine PrecisionCX Complex Machine Precision

Comma or blank(s) can be used for delimiter.

NRepeat INPUT Number of repeated TermDescriptor

TermData INPUT Buffer contains the Record term data to get

NTermGet OUTPUT Number of Terms have been gotten in record

NWordGet OUTPUT Number of Words have been gotten in record

Page 163: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

155CHAPTER 6Table I/O APIs

Application Notes.

1. DataBlock has to be pre-allocated via NServer_AllocDatablk.

2. DataBlock has to be open using option 'G' (Get) in NServer_OpenDatablk or NServer_GOpenDatablk.

3. After getting all entries, DataBlock should be closed via NServer_CloseDatablk and trailer should be written via NServer_WriteTrailer.

4. DataBlock's data format is not limited to NDDL typed data. For example, you can apply your own data description for ZUZR DataBlocks.

Example of C-program Application Usage.

A basic format descriptor for GRID cards of GEOM1 table:

"2I 3RX 3I", which applied to a data structure of 8 terms of 11 words on double machine or 8 words on a single machine

To get 4 GRID cards from GEOM1 DataBlock:

NRepeat = 4;(void) NServer_GetRecTerm( GrpName, GEOM1Filept, "2I,3RX,3I", NRepeat, (INTEGER *)GRIDdataout, &NTermGet, &NWordGet, EOR, &EORret, &Error );

EOR INPUT End of Record control flag

= 0: No advance to next record after getting data terms= 1: Advance to next record after getting data terms

EORret OUTPUT Return flag for EOR indicator

Error OUTPUT Server return status error

Func. Ret. OUTPUT Server return error flag.

Page 164: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

156

Alternatively, it can be coded as:

NRepeat = 1;(void) NServer_GetRecTerm( GrpName, GEOM1Filept, "4(2I,3RX,3I)", NRepeat, (INTEGER *)GRIDdataout, &NTermGet, &NWordGet, EOR, &EORret, &Error );

Page 165: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

157CHAPTER 6Table I/O APIs

NServer_SizeofServerNDDLTerm - Get Size of NDDL Term (Server)

From FORTRAN:

CALL NSSZNDL (...)

From C:

Purpose. Get the Server’s size in integer words of NDDL term(s)

Arguments.

int NServer_SizeofServerNDDLTerm

( char *GrpName, char *NDDLTerm,INTEGER *NintegerWord, INTEGER *Error);

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier

NDDLTerm INPUT String contains one or more NDDL term(s)

Types signature are identical to NDDL types:

I IntegerRS Real Single PrecisionCHAR4 Character 4RD Real Double PrecisionCS Complex Single PrecisionCD Complex Double PrecisionLOGICAL LogicalRX Real Machine PrecisionCX Complex Machine Precision

Comma or blank(s) can be used for delimiter.

NintegerWord OUTPUT Number of counted integer words in NDDLTerm

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

NDDL Term Size on 32-Bit Machine Size on 64-Bit Machine

I 1 1

RS 1 1

CHAR4 1 1

Page 166: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

158

RD 2 2

CS 2 2

CD 4 4

LOGICAL 1 1

RX 2 1

CX 4 2

NDDL Term Size on 32-Bit Machine Size on 64-Bit Machine

Page 167: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

159CHAPTER 6Table I/O APIs

NServer_SizeofClientNDDLTerm - Get Size of NDDL Term (Client)

From FORTRAN:

CALL NSZCNDL (...)

From C:

Purpose. Get the Client’s size in integer words of NDDL term(s).

Arguments.

int NServer_SizeofClientNDDLTerm

( char *NDDLTerm, INTEGER *NintegerWord, INTEGER *Error);

NDDLTerm INPUT String contains one or more NDDL term(s)

Types signature are identical to NDDL types:

I IntegerRS Real Single PrecisionCHAR4 Character 4RD Real Double PrecisionCS Complex Single PrecisionCD Complex Double PrecisionLOGICAL LogicalRX Real Machine PrecisionCX Complex Machine Precision

Comma or blank(s) can be used for delimiter.

NintegerWord OUTPUT Number of counted integer words in NDDLTerm

Error OUTPUT Return status error

Func. Ret. OUTPUT Server return error flag.

Page 168: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

160

Page 169: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

The following ...Pack and ...Unpack API’s provide a standard full column (with zero’s expanded) capability as well as a “sparse” set of API’s (PackColumnI, UnpackColumnI) that use only the non-zero terms and a corresponding array of row#’s for these terms. All matrices within MSC.Nastran can be accessed using either type of sparse or non-sparse Pack/UnPack API.

CHAPTER

7 Matrix I/O APIs

■ Matrix APIs

Page 170: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

162

7.1 Matrix APIs

NServer_PackColumn - Write a Matrix Column

From FORTRAN:

CALL NSPAKCL(...)

From C:

Purpose. Interface call to write a matrix's Column to a datablock. This API is used when the entire column, including zeros, is input.

Arguments.

int NServer_PackColumn

( char *GrpName , INTEGER Filept , INTEGER *ColCntl , INTEGER *Trailer , MACHINEPRECISION *Column , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

ColCntl INPUT A 5-word array of Column Control block

Word 1 - Type of input data (Column)

Word 2 - Type of output data (stored in matrix)

Word 3 - Begin row number

Word 4 - End Row number

Word 5 - Row Increment

Trailer INPUT The trailer (7 words).

Column INPUT Column Data.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Note: To make a null column, call NServer_PackNullColumn.

Page 171: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

163CHAPTER 7Matrix I/O APIs

Examples. This first program (MATRIX) demonstrates how to write ("pack") data to a matrix. The second program (Example3c) demonstrates how to write (“pack”) and read(“unpack”) data from a matrix.

Page 172: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

164

PROGRAM MATRIXCC Purpose: Small Test Program to put a matrix into a NASTRAN database.C DMAP must contain HALT statement.CC ---------------------------------------------------------------------C PARAMETER (NROW=10,NCOL=5,MAXLEN=1000)C CHARACTER*8 SBDMAP,DMAP CHARACTER*39 STRING CHARACTER*(MAXLEN) DBLISTC INTEGER ITRAIL(7),ICCNTL(5)CCCC Start the NASTRAN Server CALL NSSTART ('matrix', . 'test_halt mem=4m scr=yes', . 'nastran', . I E R A P I) IF (IERAPI .NE. 0) GO TO 999CC Execute Solution Sequence CALL NSSOLEX('matrix' , I E R A P I ) IF (IERAPI .NE. 0) GO TO 990CC Wait for DMAP to reach Breakpoint (e.g., DMAP HALT $) 1 CONTINUE IWAIT=0 CALL NSEXSTA ('matrix',IWAIT, I S T A T , S B D M A P , . D M A P , I S Q N , N D B , N P A R M , . I E R A P I ) WRITE(*,*) 'Waitmode = ',IWAIT WRITE(*,*) 'ExeStatus = ',ISTAT WRITE(*,*) 'SubDMAP = ',SBDMAP WRITE(*,*) 'DMAP = ',DMAP WRITE(*,*) 'DMAPSeqno = ',ISQN WRITE(*,*) 'Ndatablk = ',NDB WRITE(*,*) 'Nparam = ',NPARM WRITE(*,*) 'Error = ',IERAPI IF (IERAPI.NE.0) GO TO 990 IF (ISTAT.NE.0) GO TO 1CC Create Matrix Datablock ZUZR1 STRING='DBCREATE DATABLK=ZUZR01 QUALS (ZUZR1=0)' CALL NSCRTDB ('matrix',STRING, I F I L P T , I S T A T , . I E R A P I ) WRITE(*,*) 'NSCRTDB ISTAT = ',ISTAT,' IERAPI = ', . IERAPI,' IFILPT = ',IFILPT IF (IERAPI.NE.0) GO TO 990CC Make a Trailer for a Rectangular Matrix IFORM=2 ITYPE=2 CALL NSMKTRL ('matrix', I T R A I L ,IFILPT, . NROW,IFORM,ITYPE, I E R A P I )

Page 173: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

165CHAPTER 7Matrix I/O APIs

IF (IERAPI.NE.0) GO TO 990C

C Open Datablock ZUZR01 CALL NSGPNDB ('matrix',IFILPT,'W','Y', I E R A P I ) WRITE(*,*) 'NSGPNDB IERAPI= ',IERAPI IF (IERAPI.NE.0) GO TO 990CC Pack the terms in the Columns (“CALL NSACKCL”)C ICCNTL(1)=1 ICCNTL(2)=ITYPE ICCNTL(5)=1C DO 20 J=1,NCOL ICCNTL(3)=J ICCNTL(4)=J COLVAL=FLOAT(J) CALL NSPAKCL ('matrix',IFILPT,ICCNTL, I T R A I L , . COLVAL, I E R A P I ) WRITE(*,*) 'J = ',J,' NSPAKCL IERAPI= ',IERAPI IF (IERAPI.NE.0) GO TO 990 20 CONTINUECC Close the Datablock CALL NSCLSDB ('matrix',IFILPT,'Y', I E R A P I ) IF (IERAPI.NE.0) GO TO 990CC Write the MATRIX Trailer CALL NSWRTRL ('matrix',IFILPT,ITRAIL, I E R A P I ) IF (IERAPI.NE.0) GO TO 990CC DBDICT CALL NSDBDIC ('matrix','DBDICT DATABLK=ZUZR01', . D B L I S T ,MAXLEN, L E N , I E R A P I ) WRITE(*,*) 'DBDICT LEN= ',LEN,' IERAPI= ',IERAPI WRITE(*,*) DBLIST(1:LEN)CC Resume DMAP Execution CALL NSRESUM ('matrix', I E R A P I ) IF (IERAPI.NE.0) GO TO 990CC Get Error Status from Solution Sequence CALL NSNSTAT('matrix', I E R A P I ) IF (IERAPI .NE. 0) GO TO 990C GO TO 999C 990 CONTINUE WRITE(*,*) 'IERAPI=',IERAPICC Exit and Close NASTRAN Server 999 CONTINUE CALL NSSEXIT('matrix' , I E R A P I ) write(*,*) 'NSSEXIT IERAPI = ',IERAPIC STOP END

Page 174: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

166

/* * Program Example3c.c * * Purpose:

* This program shows how to write (“Pack”) and read (“UNPACK”) * a matrix type datablock. * * Note: This Example3c program’s input file (example3.dat) and its * output files (.f04, .f06, .prt) can be found in * the Toolkit Code Librarian “Help” system supplied * on the Toolkit Delivery CD. * * How to invoke: * * After compile and link, execute the program Example3c: * * ./Example3c NASTRAN_Program_script list_of_NASTRAN_Program_script_args * * e.g ./Example3c `which nastran` example3 scr=yes mem=10m out=example3c * * input to NASTRAN server : example3.dat * output from this Example3c program : example3c.prt * output from NASTRAN server : example3c.f04, example3c.f06 * * * * The following functions are used in this example: * ============================================== * * 1) Supported Utility functions * * (void) DumpMatrix * (void) GetArgument * (void) OpenLogFile * (void) PackMatrix * (void) PrintMessage * * 2) MSC.Nastran API Toolkit Library functions * * Please consult nsapilib.h or other documents * for the function description and calling sequence. * * (void) NServer_AllocDatablk * (void) NServer_CloseDatablk * (void) NServer_CreateDatablk * (void) NServer_Dbdict * (void) NServer_ExeStatus * (void) NServer_Exit * (void) NServer_GOpenDatablk * (void) NServer_GetMessage * (void) NServer_MakeTrailer * (void) NServer_PackColumn * (void) NServer_PackColumnI * (void) NServer_PackNullColumn * (void) NServer_ReadTrailer * (void) NServer_SolExeN * (void) NServer_SolResumeN

Page 175: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

167CHAPTER 7Matrix I/O APIs

* (void) NServer_Start * (void) NServer_UnpackColumn * (void) NServer_WriteTrailer *

* 3) A Client Main program to call the above functions * */

#include <stdio.h>#include <string.h>#include "nsapilib.h"

static FILE *LOGFILE = NULL;

void GetArgument( char *GrpName, char *NastPath, char *CommandLine, int argc, char *argv[]);

void OpenLogFile( char *CommandLine );

void PrintMessage (char *GrpName, FILE *fp, char *ApiName);

void DumpMatrix( char *GrpName, char *AllocStr , INTEGER *Filept, INTEGER *Error );

void PackMatrix( char *GrpName, char *CreateString, INTEGER *Filept, INTEGER PackOption, INTEGER *Error );

main(int argc, char *argv[]){ char GrpName[257]; char NastPath[1025]; char CommandLine[1025];

char *DbdictString ={"DBDICT DATABLK(ZUZR11) SELECT(NAME,DBSET,VERSON,KEY,ZNAME)"};

char DbdictOut[40000];

INTEGER Error=0; INTEGER OutLen=0,MaxLen=40000;

char SubDmap[9], Dmap[9]; INTEGER Dmpseqnum=0; INTEGER InitFlag, WaitMode=0, ExeStatus=0, Ndatablk=0, Nparam=0;

char ApiName[82]= {"main_program_at_exit" };

char AllocStr[80];

INTEGER Filept1, Filept2, Filept3, PackOption;

int i=0;LOGFILE = stderr;

/****************************************************************************** * * Step 1: Parse the program arguments into GrpName, NastPath and CommandLine * ******************************************************************************

Page 176: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

168

*/

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv);

(void) OpenLogFile( CommandLine );

/*************************************************************************** * * Step 2: Initilize the MSC.Nastran server * ************************************************************************** */ (void) NServer_Start ( GrpName , CommandLine , NastPath , &Error);

(void) fprintf(LOGFILE," >>> NServer_Start GrpName=%s\n" " CommandLine=%s\n" " NastPath=%s\n" " Error=%d\n", GrpName,CommandLine,NastPath,Error);

if( Error ) { strcpy( ApiName,"NServer_Start"); goto EXIT; }

/**************************************************************************** * * Step 3: Execution of solution in non-blocking mode * **************************************************************************** */

(void) NServer_SolExeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolExeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolExeN"); goto EXIT; }

/**************************************************************************** * * Step 4: Loop over the DMAP breakpoint or at DMAP EXIT * **************************************************************************** */

WaitMode = 0;

for( ; ; ) {

/**************************************************************** * * Step 4.a: Get the Dmap Execution status after the HALT DMAP * **************************************************************** */

Page 177: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

169CHAPTER 7Matrix I/O APIs

(void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

(void) fprintf(LOGFILE, " >>> NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Error); if( Error ) { strcpy( ApiName,"NServer_ExeStatus"); goto EXIT; }

/************************************************************** * * Step 4.b: Get out of for loop at the end of DMAP sequence * ************************************************************** */ if( !strncmp(Dmap,"EXIT",4) || Error ) break;

if( !strncmp(Dmap, "HALT",4) ) {/* * At DMAP Breakpoint HALT $ */ (void) NServer_Dbdict ( GrpName , DbdictString , DbdictOut , MaxLen, &OutLen , &Error ) ;

(void) fprintf(LOGFILE," >>> NServer_Dbdict DbdictString=\n" " %s\n" " >>> NServer_Dbdict DbdictOut=\n%s", DbdictString,DbdictOut);

/*********************************************************************** * * Step 4.c : Unpack the ZUZR11 matrix, which has been created by DMAP * *********************************************************************** */ sprintf(AllocStr,"DATABLK=ZUZR11 WHERE(ZNAME='DMAPGEN')"); Filept1 = 0;

(void) DumpMatrix ( GrpName, AllocStr , &Filept1, &Error );

/******************************************************************** * * Step 4.d : Pack ZUZR11 matrix with qualifier ZNAME='API1GEN', * using whole column * ******************************************************************** */

sprintf(AllocStr,"DATABLK=ZUZR11 QUALS(ZNAME='API1GEN')"); Filept2 = 0; PackOption = 1;

(void) PackMatrix( GrpName, AllocStr, &Filept2, PackOption, &Error );

Page 178: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

170

/****************************************************************** * * Step 4.e : Pack ZUZR11 matrix with qualifier ZNAME='API2GEN', * using non-zer terms with column index * ****************************************************************** */

sprintf(AllocStr,"DATABLK=ZUZR11 QUALS(ZNAME='API2GEN')"); Filept3 = 0; PackOption = 2;

(void) PackMatrix( GrpName, AllocStr, &Filept3, PackOption , &Error);

(void) NServer_Dbdict ( GrpName , DbdictString , DbdictOut , MaxLen, &OutLen , &Error ) ; (void) fprintf(LOGFILE," >>> NServer_Dbdict DbdictString=\n" " %s\n" " >>> NServer_Dbdict DbdictOut=\n%s", DbdictString,DbdictOut);

/***************************************************************************** * * Step 4.f : Read the ZUZR11 matrix, which has been created by this program * ***************************************************************************** */ (void) DumpMatrix ( GrpName, NULL , &Filept2, &Error );

(void) DumpMatrix ( GrpName, NULL , &Filept3, &Error );

}

/*********************************************************************************************** * * Step 5: Resume DMAP execution after the breakpoint and back to the loop for next break point * *********************************************************************************************** */

(void) NServer_SolResumeN( GrpName , &Error );

(void) fprintf(LOGFILE, " >>> NServer_SolResumeN Error=%d\n",Error);

if( Error ) { strcpy( ApiName,"NServer_SolResumeN"); goto EXIT; }

} /* end of for loop */

/******************************************* *

Page 179: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

171CHAPTER 7Matrix I/O APIs

* Step 6: EXIT and terminate the server * ******************************************* */

EXIT: (void) PrintMessage (GrpName, LOGFILE, ApiName );

(void) NServer_Exit( GrpName , &Error );

(void) fprintf(LOGFILE," >>> NServer_Exit Error=%d\n",Error);

if( LOGFILE != stderr ) fclose (LOGFILE );}

#if(0)#define REAL_SINGLE 1#define REAL_DOUBLE 2#define COMPLEX_SINGLE 3#define COMPLEX_DOUBLE 4#endif

void DumpMatrix ( char *GrpName, char *AllocStr , INTEGER *Filept, INTEGER *Error )

/************************************************************************** * Purpose: Dump the content of the matrix datablock * * input: * *GrpName - Group name * *AllocStr - Allocation string of the matrix * *Filept - File pointer * *Error - Error return *************************************************************************/

{ INTEGER Trailer[7]; INTEGER UnpkCntl[4]; INTEGER NCol,NRow,Type,ColStat,RowStat,n,Nmatch; MACHINEPRECISION *Column=NULL;

int i;

if( !(*Filept) ) {

/* * Allocate of datablock */ (void) NServer_AllocDatablk( GrpName, AllocStr, Filept, &Nmatch, Error );

fprintf(LOGFILE," >>> NServer_AllocDatablk AllocStr=%s\n Filept=%d Nmatch=%d\n", AllocStr,*Filept,Nmatch);

}

Page 180: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

172

if( !(*Filept) ) return;/* * Read table/matrix trailer */ (void) NServer_ReadTrailer( GrpName, *Filept , Trailer , Error );

fprintf(LOGFILE," >>> NServer_ReadTrailer\n"); for( i=0; i<7;i++) fprintf(LOGFILE," Trailer[%d]= %12d\n",i+1,Trailer[i]);

/* * Cols Rows F T NzWds Density BlockT StrL NbrStr BndAvg BndMax NulCol * 18 18 6 2 12 3.08600D-01 3 2 44 9 15 0 */

if( !Trailer[0] ) { fprintf(LOGFILE," >>> Matrix Filept=%d is purged\n",*Filept); return; }

NCol = Trailer[1]; NRow = Trailer[2]; Type = Trailer[4];

if ( Column ) free( Column );/* to hold one column data */ Column = (MACHINEPRECISION *)malloc( NRow * sizeof(MACHINEPRECISION) ); if( !Column ) return;

/* * GOpen the Matrix */ (void) NServer_GOpenDatablk( GrpName , *Filept , 'R' , 'Y' , Error );

fprintf(LOGFILE," >>> Matrix Filept=%d Dimension: %d Columns and %d Rows of Type=%d\n", *Filept,NCol,NRow,Type);

/* * Loop thru columns and unpack */ for(n=0; n< NCol; n++) { UnpkCntl[0] = Type ; UnpkCntl[1] = 1; UnpkCntl[2] = NRow; UnpkCntl[3] = 1;

(void) NServer_UnpackColumn ( GrpName , *Filept , UnpkCntl , Column , &ColStat , Error );

Page 181: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

173CHAPTER 7Matrix I/O APIs

if( !ColStat ) fprintf(LOGFILE," >>> Matrix Column(%3d) is a NULL Column\n",n+1); else { for(i=0; i<NRow ; i++) if( Column[i] ) { fprintf(LOGFILE," >>> Matrix Column(%3d) Row(%3d) = %2.4e \n", n+1,i+1,Column[i]); } }

}

if ( Column ) free( Column );

/* * CLose the Datablk */ (void) NServer_CloseDatablk( GrpName , *Filept , 'N' , Error );

}

#define ROWSIZE 5 #define RECTANGULAR 2#define REALDOUBLE 2

void PackMatrix( char *GrpName, char *CreateString, INTEGER *Filept, INTEGER PackOption, INTEGER *Error )

{

/************************************************************************** * Purpose: Pack a matrix datablock * * input: * *GrpName - Group name * *CreateString - Creation String of the matrix * *Filept - File pointer * PackOption - Option selection to pack the matrix * *Error - Error return *************************************************************************/

INTEGER FileStat, NbrNull=1, Nzero=0; int i;

MACHINEPRECISION Column1[ROWSIZE]={ 100. , 200., 300. , 0. , 0. }; INTEGER Colindex1[3] ={ 1, 2, 3 }; INTEGER Nindex1=3;

MACHINEPRECISION Column3[ROWSIZE]={ 0. , 200., 0. , 400. , 0. }; MACHINEPRECISION Column3X[2] ={ 200., 400. }; INTEGER Colindex3[2] ={ 2, 4 }; INTEGER Nindex3=2;

MACHINEPRECISION Column5[ROWSIZE]={ 0. , 0. , 300. , 400. , 500. }; MACHINEPRECISION Column5X[3] ={ 300. , 400. , 500. }; INTEGER Colindex5[3] ={ 3, 4, 5 };

Page 182: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

174

INTEGER Nindex5=3;

INTEGER Trailer[7], PackCntl[5];

INTEGER NRow,MatType, MatForm;

NRow = ROWSIZE; MatForm = RECTANGULAR; MatType = REALDOUBLE;

if( !(*Filept) ) {/* * Create a datablock to output data */ (void) NServer_CreateDatablk ( GrpName , CreateString , Filept , &FileStat ,Error );

(void) fprintf(LOGFILE, " >>> NServer_CreateDatablk CreateString=%s\n",CreateString); (void) fprintf(LOGFILE, " Filept=%d FileStat=%d Error=%d\n",*Filept,FileStat,*Error); }

if( !(*Filept) || *Error ) return;/* * Open datablock to write */ (void) NServer_GOpenDatablk( GrpName , *Filept , 'W' , 'Y' , Error );

(void )NServer_MakeTrailer ( GrpName , Trailer , *Filept , NRow , MatForm , MatType ,Error );

PackCntl[0] = MatType; PackCntl[1] = MatType; PackCntl[2] = 1; PackCntl[3] = ROWSIZE; PackCntl[4] = 1;

switch ( PackOption ) {

/******************************* * * USING PACK COLUMN * ******************************* */ case 1 :

/* * * Pack columns 1,3, and 5. * Column 2,4 are NULL * */ (void) NServer_PackColumn ( GrpName , *Filept , PackCntl , Trailer , Column1 , Error ) ; (void) NServer_PackNullColumn ( GrpName , *Filept , PackCntl , Trailer , NbrNull , Error ) ;

Page 183: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

175CHAPTER 7Matrix I/O APIs

(void) NServer_PackColumn ( GrpName , *Filept , PackCntl , Trailer , Column3 , Error ) ; (void) NServer_PackNullColumn ( GrpName , *Filept , PackCntl , Trailer , NbrNull , Error ) ; (void) NServer_PackColumn ( GrpName , *Filept , PackCntl , Trailer , Column5 , Error ) ;

break;

/************************************************* * * USING PACK COLUMN WITH INDEX OF NON-ZERO TERM * ************************************************* */ case 2 :

/* * * Pack columns 1,3, and 5. * Column 2,4 and 6 are NULL * */ PackCntl[3] = Nindex1; (void) NServer_PackColumnI ( GrpName , *Filept , PackCntl , Trailer , Column1 , Colindex1 , Nindex1, Error ); (void) NServer_PackNullColumn ( GrpName , *Filept , PackCntl , Trailer , NbrNull , Error ) ; PackCntl[3] = Nindex3; (void) NServer_PackColumnI ( GrpName , *Filept , PackCntl , Trailer , Column3X , Colindex3 , Nindex3, Error ); (void) NServer_PackNullColumn ( GrpName , *Filept , PackCntl , Trailer , NbrNull , Error ) ; PackCntl[3] = Nindex5; (void) NServer_PackColumnI ( GrpName , *Filept , PackCntl , Trailer , Column5X , Colindex5 , Nindex5, Error );

break; }

/* * Close datalock and write trailer */ (void) NServer_CloseDatablk ( GrpName , *Filept , 'Y' , Error ); (void) NServer_WriteTrailer ( GrpName , *Filept , Trailer , Error );}

Page 184: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

176

NServer_PackColumnI - Write a Column Using a Sparse Matrix Format

From FORTRAN:

CALL NSPAKCI(...)

From C:

Purpose. Interface call to write a matrix's Column using sparse input form. Only non-zero rows and their row locations are input to this API.

Arguments.

Example. See NServer_PackColumn on page 163.

int NServer_PackColumnI

( char *GrpName , INTEGER Filept , INTEGER *ColCntl ,INTEGER *Trailer, MACHINEPRECISION *Column , INTEGER *RowIdx , INTEGER *IdxLen ,INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

ColCntl INPUT A 5-word array of Column Control block

Word 1 - Type of input data (Column)

Word 2 - Type of output data (stored in matrix)

Word 3 - Begin row number

Word 4 - End Row number

Word 5 - Row Increment

Trailer INPUT/OUPUT

The datablock’s 7 word trailer.

Column INPUT Column Data.

RowIdx INPUT Index of the non-zero rows in Column.

IdxLen INPUT Length of RowIdx.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 185: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

177CHAPTER 7Matrix I/O APIs

NServer_PackNullColumn - Write a Null Column

From FORTRAN:

CALL NSPCKNU(...)

From C:

Purpose. Write a matrix's Null Column.

Arguments.

Example. See NServer_PackColumn on page 163.

int NServer_PackNullColumn

( char *GrpName, INTEGER Filept, INTEGER *ColCntl, INTEGER *Trailer, INTEGER NbrNull, INTEGER *Error );

GrpName INPUT (Max. 256 chars.)

Groupd name, the Server’s unique identifier.

Filept INPUT File Handle for reference of the DataBlock

ColCntl INPUT A 5-word array of Column Control block

Word 1 - Type of input data (Column)

Word 2 - Type of output data (stored in matrix)

Word 3 - Begin row number

Word 4 - End Row number

Word 5 - Row Increment

Trailer INPUT/OUTPUT

The DataBlock’s 7-word Trailer.

NbrNull INPUT Number of Null Columns.

Error OUTPUT Return Server’s status error.

Func. Ret. OUTPUT Return Server’s status error.

Page 186: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

178

NServer_UnpackColumn - Read a Matrix Column

From FORTRAN:

CALL NSUNPKC(...)

From C:

Purpose. Interface call to read a matrix's Column. This API returns the full column, including zero terms..

Arguments.

int NServer_UnpackColumn

( char *GrpName , INTEGER Filept , INTEGER *ColCntl , MACHINEPRECISION *Column , INTEGER *ColStat , INTEGER *Error);

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock file handle from previous allocation or creation.

ColCntl INPUT/OUTPUT

Column Control block: a 4-int-word array

Word 1 - Type of Output data

Word 2 - Begin Row number

Word 3 - End Row number

Word 4 - Row Increment

Column OUTPUT Column Data.

ColStat OUTPUT Status of the Column.

= 0 indicates a NULL Column. (Note that the output Column data will be undefined in this case).

= nonzero indicates the number of words returned in Column data.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 187: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

179CHAPTER 7Matrix I/O APIs

Example. A subroutine that uses the " Unpack" API. See also NServer_PackColumn example on page 163.

SUBROUTINE WRTMPC (GRPNAM,LNBUF,IBUF,IUNIT,NRGRID,INFRGD, I R C )CC This subroutine writes the MPC equations relating the physicalC degrees of freedom to the modal degrees of freedom to the file C of the modal model.CC Input GRPNAM ... Group Name of the ServerC LNBUF ... Length of Working ArrayC IBUF(*) ... Working ArrayC IUNIT ... FORTRAN unit of output fileC NRGRID ... Number of Grids in Residual ModelC INFRGD(3,*) ... Residual Grid Information TableC Output IRC ... Return Code: 0 = Normal EndC <>0 = Errors FoundCCC ----------------------------------------------------------------------C CHARACTER*(*) GRPNAM CHARACTER*80 CVALC INTEGER IBUF(*),INFRGD(3,*) INTEGER ITRAIL(7),LISDOF(6),INFCOL(4)C DATA UNIT /-1./, ZERO /0./C ... CC Allocate Datablock ZUZR01 (contains modal displacements)C CALL NSALLDB (GRPNAM,'DATABLK=ZUZR01 WHERE (ZUZR1=2)', . I F I L P T , N M A T C H , I E R A P I ) IF (IERAPI.NE.0.OR.NMATCH.NE.1) GO TO 910 CC Get Information from TrailerC CALL NSRDTRL (GRPNAM,IFILPT, I T R A I L , I E R A P I ) IF (IERAPI.NE.0) GO TO 920 NMODES=ITRAIL(3) IPREC =ITRAIL(5) LNNEED=IPREC*NMODES IF (LNNEED.GT.LNBUF) GO TO 930CC Open ZUZR01C CALL NSGPNDB (GRPNAM,IFILPT,'R','Y', I E R A P I ) IF (IERAPI.NE.0) GO TO 921CC Loop over DOFSC INFCOL(1)=IPREC INFCOL(2)=1 INFCOL(3)=NMODES INFCOL(4)=1

Page 188: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

180

C DO 200 IGRID=1,NRGRIDC IDOFS=INFRGD(3,IGRID)C IF (NDOFG.EQ.6.OR.IDOFS.EQ.0) THENC DO 210 K=1,NDOFGC WRITE(IUNIT,2000) MPCID,INFRGD(1,IGRID),K,UNITCC Unpack a column into IBUF CALL NSUNPKC (GRPNAM,IFILPT,INFCOL, I B U F , . I C L S T , I E R A P I )C IF (IERAPI.NE.0) GO TO 922C IF (ICLST.EQ.0) THEN WRITE(IUNIT,2100) IDSP1,ZERO ELSE

C Note: SWRMPC/DWRMPC below are not Toolkit supplied utilities--they are shown hereC simply to demonstrate how a typical application might be structured to handleC both double and single precision matrices.

IF (IPREC.EQ.1) THENC Write utility for matrix data that is single precision CALL SWRMPC (IUNIT,NMODES,IBUF,IDSP1) ELSEC Write utility for matrix data that is double precision CALL DWRMPC (IUNIT,NMODES,IBUF,IDSP1) ENDIF ENDIFC 210 CONTINUEC ELSEC ... C ENDIFC 200 CONTINUECC Close ZUZR01C 990 CALL NSCLSDB (GRPNAM,IFILPT,'N', I E R A P I ) IF (IERAPI.EQ.0) GO TO 999CC Error BranchC ... C 999 CONTINUE RETURN END

Page 189: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

181CHAPTER 7Matrix I/O APIs

NServer_UnpackColumnI - Read a Sparse Matrix Column

From FORTRAN:

CALL NSUNPKI(...)

From C:

Purpose. Interface call to read a matrix's Column. Data is returned in sparse form where only non-zero terms and their locations are returned.

Arguments.

Example. An example is provided in the "Toolkit Code Librarian" help system (Training Example 3).

int NServer_UnpackColumnI

( char *GrpName , INTEGER Filept , INTEGER *ColCntl ,

MACHINEPRECISION *Column , INTEGER *ColStat, INTEGER

*RowIdx , INTEGER *RowStat , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation

ColCntl INPUT Column Control block: a 4-int-word array

Word 1 - Type of Output data

Word 2 - Begin Row number

Word 3 - End Row number

Word 4 - Row Increment

Column OUTPUT Column Data

ColStat OUTPUT Status of the Column (0 for NULL Column, nonzero for number of words stored)

RowIdx OUTPUT Index of the non-zero rows in Column

RowStat OUTPUT Status of the RowIdx

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 190: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

182

NServer_UnpackRowIdx - Unpack a Matrix Row Index

From FORTRAN:

CALL NSUNPKX(...)

From C:

Purpose. Interface call to read the Row-Indices for Non-Zero Terms of a matrix's column.

Arguments.

Example. An example is provided in the "Toolkit Code Librarian" help system (Training Example 3).

int NServer_UnpackRowIdx

( char *GrpName , INTEGER Filept , INTEGER *ColCntl , INTEGER *RowIdx , INTEGER *RowStat , INTEGER *Error );

GrpName INPUT An unique identifier for the Client/Server communication. (Max. 256 chars.)

Filept INPUT Datablock File handle from previous allocation or creation.

ColCntl INPUT Column Control block: a 4-int-word array

Word 1 - Type of Output data

Word 2 - Begin Row number

Word 3 - End Row number

Word 4 - Row Increment

RowIdx OUTPUT Index of the nonzero rows in Column.

RowStat OUTPUT Status of the RowIdx.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 191: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

CHAPTER

8 Direct Access I/O APIs

■ Grid Direct Access API's

■ Element Connectivity and Property Recovery API (IFP API's)

■ Summary of How to Use the IFP API's

■ Data Recovery API's (OFP Type Datablocks)

Page 192: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

184

8.1 Grid Direct Access API'sEither of two methods may be used to read grid information from the database. With the first method, the grid cards are read from BGPDT data block using NServer_ReadXYZ. Reading from BGPDT with NServer_ReadXYZ has the advantage that the x, y, z output is returned in the basic coordinate system. In the second method, grid data is read from GEOM1 data block using NServer_ReadIndexedIFP. In this method, data is closer to form of the input bulk data deck but is in whatever coordinate system the user input on their card. Reading from BGPDT is discussed in this section, while reading from GEOM1 is discussed in the next section.

Page 193: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

185CHAPTER 8Direct Access I/O APIs

NServer_ReadGID - Get Grid IDs

From FORTRAN:

CALL NSRGID(...)

From C:

Purpose. Returns a list of all the grid ID's contained with the BGPDT file (referenced by the file handle Filept).

Arguments.

Example. See the NServer_ReadXYZ example on page 186.

int NServer_ReadGID

( char *GrpName, INTEGER Filept, INTEGER BeginEntry, INTEGER *GIDRecord, INTEGER RecLeng, INTEGER *GIDStat, INTEGER *MaxEntry, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier.

Filept INPUT File Handle for BGPDT datablock.

BeginEntry INPUT Begin entry of the GID record to read.

GIDRecord OUTPUT Buffer to hold the GID record.

RecLeng INPUT Length of the Record in word.

GIDStat OUTPUT Return status of the read record

>= 0: Number of entries has been read

< 0: problem with index file

MaxEntry OUTPUT The maximum size in words (i.e., number of grids) of the GID record.

Error OUTPUT Return Server’s status error.

Func. Ret. OUTPUT Server return error flag.

Page 194: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

186

NServer_ReadXYZ - Get Grid Coordinates

From FORTRAN:

CALL NSRXYZ(...)

From C:

Purpose. Returns requested grid data from BGPDT Filept given a list of grid ID’s. The x,y,z coordinates are returned in the BASIC coordinate system for each of the requested ids.

Arguments.

Example. The following examples demonstrates use of both the NServer_ReadXYZ and the NServer_ReadGID API.

Note that some general guidelines apply to both these API's.

• Your DMAP must save BGPDT data block on one of the permanent DBSETs.

int NServer_ReadXYZ

( char *GrpName, INTEGER Filept, INTEGER *GIDRecord, MACHINEPRECISION *XYZRecord, INTEGER RecLeng, INTEGER *OutLeng, INTEGER *XYZStat, INTEGER *Error );

GrpName INPUT (Max Length = 256)

Group name, the Server's unique identifier.

Filept INPUT File Handler for BGPDT datablock.

GIDRecord INPUT Buffer to hold the GIDRecord.

XYZRecord OUTPUT Buffer to hold the XYZRecord with 3 MACHINEPRECISION data terms per entry.

RecLeng INPUT Entry length of the input GIDRecord or Maximum Entry length for the output XYZRecord.

OutLeng OUTPUT Return Entry length used to hold the output XYZRecord.

XYZStat OUTPUT Return status of the read record

= 0: read OK

> 0: number of bad entries in GIDRecords

< 0: problem with index table

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 195: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

187CHAPTER 8Direct Access I/O APIs

• Assuming the client code has performed the normal startup API calls, the client must allocate the saved BGPDT data block (see NServer_AllocDatablk).

• NServer_ReadGID or NServer_ReadXYZ can be called one or more times. As with all client/server API's efficiency is enhanced if multiple ID's are processed in each call.

Page 196: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

188

/* * File: NSgetXYZ.c * * Purpose: to run a single nastran job via the toolkit * and get GID, XYZ output * * How to run: * * ./NSnastran `which nastran` bcell2a scr=no mem=4m * * DMAP alter on bcell2.dat : * * compile PHASE0 $ * alter 'GP3 ' * exit * */

#include <stdio.h>#include <stdlib.h>#include <nsapilib.h>#include "Utool.h"#include <string.h>#define LENG 8

main (int argc, char *argv[]){ char GrpName[257]; char NastPath[1025]; char CommandLine[1025]; char Command[1025];

char SubDmap[9], Dmap[9]; INTEGER Dmpseqnum, Nbreak; INTEGER WaitMode, ExeStatus, Ndatablk, Nparam, Error;

INTEGER i,j,Filept, BeginEntry, RecLeng, GIDStat, MaxEntry, OutLeng, XYZStat; INTEGER GIDRecord[LENG]; MACHINEPRECISION XYZRecord[LENG*3];

/* * (0) Parse the program arguments in to GrpName, NastPath and CommandLine */

(void) GetArgument( GrpName, NastPath, CommandLine, argc, argv);

/* * (1) INIT THE SERVER */

(void) fprintf(stderr," Call NServer_Start for Group %s NastPath=%s\n",GrpName,NastPath); (void) fprintf(stderr," CommandLine is %s\n",CommandLine);

(void) NServer_Start ( GrpName , CommandLine , NastPath , &Error);

Page 197: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

189CHAPTER 8Direct Access I/O APIs

if( Error ) { (void) fprintf(stderr," An error code %d has been detected in NServer_Start and run exits \n",Error); (void) Fetch_Messages (GrpName, stdout ); goto EXIT; }

/* * (2) EXECUTION OF SOLUTION IN NON-BLOCKING MODE */

(void) fprintf(stderr, " Call NServer_SolExeN for Group %s\n",GrpName);

(void) NServer_SolExeN( GrpName , &Error );

WaitMode = 0;/* * (3) GET THE EXECUTION STATUS */

(void) NServer_ExeStatus(GrpName, WaitMode, &ExeStatus, SubDmap , Dmap, &Dmpseqnum, &Ndatablk,&Nparam, &Error);

/* * DMAP alter has been made to exit after GP3 module, where * BGPDT is available with the gino file number 102 */

(void) fprintf(stderr, " Return from NServer_ExeStatus: SubDmap=%s\n" " Dmap=%s\n" " Dmpseqnum=%d\n" " Ndatablk=%d\n" " Nparam=%d\n" " Error=%d\n", SubDmap,Dmap,Dmpseqnum,Ndatablk,Nparam,Error);

if( Error ) goto EXIT;;

/* * (4) GET GID and XYZ */

Filept=102;

GIDStat=0; GIDStat=0; RecLeng=LENG;

BeginEntry=1;

for ( ; ; ) { (void) NServer_ReadGID ( GrpName,Filept,BeginEntry,GIDRecord,RecLeng,&GIDStat,&MaxEntry,&Error);

fprintf(stderr," NServer_ReadGID Filept=%d BeginEntry=%d RecLeng=%d GIDStat=%d MaxEntry=%d Error=%d\n",

Page 198: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

190

Filept,BeginEntry,RecLeng,GIDStat,MaxEntry,Error); (void) NServer_ReadXYZ( GrpName,Filept,GIDRecord,XYZRecord,RecLeng,&OutLeng,&XYZStat,&Error);

fprintf(stderr," NServer_ReadXYZ Filept=%d RecLeng=%d OutLeng=%d XYZStat=%d Error=%d\n", Filept,RecLeng,OutLeng,XYZStat,Error);

for (j=0,i=0 ; i < OutLeng*3; j++,i+=3) fprintf(stderr,"G=%10d X=%10f Y=%10f Z=%10f\n", GIDRecord[j],XYZRecord[i],XYZRecord[i+1],XYZRecord[i+2]);

if( GIDStat>0 ) BeginEntry+=GIDStat; RecLeng = (BeginEntry+RecLeng > MaxEntry ? MaxEntry-BeginEntry+1 : RecLeng) ;

if( BeginEntry > MaxEntry ) break;

}

EXIT:

/* * (5) EXIT THE SERVER */

(void) fprintf(stderr," Before NServer_Exit\n"); (void) NServer_Exit( GrpName , &Error );

Page 199: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

191CHAPTER 8Direct Access I/O APIs

8.2 Element Connectivity and Property Recovery API (IFP API's)MSC.Nastran's data cards are placed within the Input File Processor (IFP) data blocks in nearly raw form . The data contained in the IFP datablocks is similar to the form used on the card but typically has flagging information and other "structure" information modified to ease subsequent reading of the data. For example, a character field on a card might be changed to an integer flag word.

The IFP module (and a few subsequent modules) output this class of data blocks at the beginning of all MSC supplied solutions sequences after the bulk data has been read and sorted. Direct access allows quick retrieval of the data cards by indexing this class of data blocks.

How to Index IFP Data

Most IFP data is readily indexed. The internal structure of the data blocks have each card type separated on record boundaries with a 3 word locate code (table, bit, card number) as the first three words of the record. Most of the cards types also have a fixed number of attributes (card fields) with the card ID as the first word in the list of attributes. Because of this rather rigid structure over 70 percent of the cards can be indexed.

It is expected the cards that are not currently indexed due to variable number of attributes will be indexed in the future.1 The NDDL contains information necessary to read the data, but unfortunately, not as a tuple.

The IFP data can be indexed in either the run that generates the IFP data blocks or during subsequent runs. A new module IFPINDX takes one of the IFP data blocks and appends an index file onto the base data. The index data is appended onto the base file as an "associated file" and as such is invisible to other modules unless they need the information. DMAP example of IFPINDX is

file geom2=append $ifpindx /geom2 $

Entries Not Indexed Due ToIndexed Percent

Var. Length No ID

103 38 333 70

1 The variable length PCOMP card is indexed currently.

Page 200: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

192

Indexing is available in MSC supplied solution sequences by either adding a NASTRAN INDEX=IFP to your bulk data deck or by adding sys316=1 on the submittal line. Note that setting sys316=2 is used to index OFP type datablocks (discussed immediately after this section on IFP API's). Setting sys316=3 will index both IFP and OFP datablocks.

Using the above indices there exists API's to read the keys from an IFP datablock (NServer_ReadIFPKeys (c) or NSRIKYS (FORTRAN)) and a API to read the associated IFP data for a given set of keys (NServer_ReadIndexedIFP (c) or NSRIIFP (FORTRAN)).

If you do not need to do any MSC.Nastran restart, but just want to save the datablocks necessary for Patran plotting capabilities you can request TDB (Toolkit Database) processing. Here the statement NASTRAN INDEX=IFP+OFP+TDB (or sys316=7) will direct the Patran subset of the IFP and OFP datablocks to MASTER dbset instead of DBALL. You can then delete DBALL dbset (perhaps with the command line argument DELETE=DBALL) and Patran (or your client code) would only need to DBLOCATE data blocks from MASTER to process information. Of course, if you only want IFP information then set NASTRAN INDEX=IFP+TDB, (or sys316=5).

Page 201: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

193CHAPTER 8Direct Access I/O APIs

8.3 Summary of How to Use the IFP API's• The DMAP must have a call to module IFPINDEX for all the IFP datablocks

you will be calling with NServer_ReadIFPKeys or NServer_ReadIndexedIFP. This module indexes the data block and stores the index information for later use. Typically you will want to index GEOM2, EPT, MPT data blocks. These datablocks must be stored permanently.

• Assuming the client code has performed the normal startup API calls, the client will allocate the appropriate IFP data block (see NServer_AllocDatablk).

• Open the datablock using NServer_OpenDatablk

• Call NServer_ReadIFPKeys or NServer_ReadIndexedIFP one or more times. API efficiency is enhanced if multiple id's are being returned.

For a detailed example that demonstrates the use of these direct access IFP API's see the Nsbrowser.f example supplied in the Toolkit Code Librarian “Help” system.

The table below provides the type of data, its NDDL description name1 and the card names for cards accessible with the IFP API.

Note: Before calling the above API (ReadIndexedIFP) you have the option of applying a filter to the data that will be returned (see NServer_Select).

1The NDDL Name is the name given to the description. Often it is the same name as the data block name, but not always. Other data blocks can also point a NDDL Description with the DATABLK SAMEAS clause. For example, GEOM2 points to ECT NDDL description name.

Type of Data NDDL Name Entries

Conical shell, Hydroelastic and acoustic

AXIC CCONEAX CFLUID2 CFLUID3 CFLUID4 FORCE FORCEAX FREEPT GRAV GRIDB GRIDF GRIDS MOMAX MOMENT OMITAX POINTAX PRESAX PRESPT RINGAX RINGFL SECTAX SEQGP SPCAX SUPAX TEMPAX TEMPD

Contact CONTACT BCONP BFRIC BNPEN

Dynamics' Related Data DYNAMIC ACSRCE DAREA DELAY DPHASE DYNRED EIGB EIGP EIGR EIGRL EPOINT FREQ1 FREQ2 FREQ3 FREQ4 NOLIN1 NOLIN2 NOLIN3 NOLIN4 RANDPS RANDT1 RLOAD1 RLOAD2 SEQEP TIC TLOAD1 TLOAD2

Page 202: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

194

Element Connectivity Table

ECT,GEOM2 BEAMAERO CAABSF CAXIF2 CAXIF3 CAXIF4 CBAR CBARAO CBEAM CBEAMP CBEND CBUSH CBUSH1D CCONE CDAMP1 CDAMP2 CDAMP3 CDAMP4 CDAMP5 CDUM1 CELAS1 CELAS2 CELAS3 CELAS4 CFLUID2 CFLUID3 CFLUID4 CINT CGAP CHACAB CHACBR CHBDYE CHBDYG CHBDYP CHEXA CHEXA20F CHEXAFD CHEXAL CHEXP CHEXPR CMASS1 CMASS2 CMASS3 CMASS4 CMFREE CONM1 CONM2 CONROD CONV CONVM CPENP CPENTA CPENPR CPENT15F CPENT6FD CQDX4FD CQDX9FD CQUAD CQUAD4 CQUAD4FD CQUAD8 CQUAD9FD CQUADP CQUADR CQUADX CROD CSHEAR CSLOT3 CSLOT4 CTETP CTETRA CTETPR CTETR10F CTETR4FD CTRIA3 CTRIA3FD CTRIA6 CTRIA6FD CTRIAP CTRIAR CTRIAX CTRIAX6 CTRIX3FD CTRIX6FD CTUBE CVISC GMINTC GMINTS PLOTEL Q4AERO RADBC SINT SPOINT T3AERO VUHEXA VUPENTA VUTETRA

Design Optimization IFP Data

EDOM DSCONS DESVAR DCONSTR DOPTPRM DOPTPRM2 DSCREEN DVGRID DVBSHAP MODTRAK

Aero and Element Deformations

EDT ACMODL AERO AEROS AESTAT AESURF CAERO1 CAERO2 CAERO3 CAERO4 CAERO5 CSSCHD DEFORM MKAERO1 MKAERO2 PAERO1 PAERO2 SET2 SPLINE1 SPLINE2 SPLINE4 SPLINE5

Element Hierarchical Table EHT EHBEAMP EHCINT EHHEXP EHPENP EHQUADP EHSINT EHTETP EHTRIAP

P-element volume and P-value dependency data

ELEMVOL HEXAP PENTAP TETRAP

Element Property Table EPT PACABS PAABSF PACBAR PBAR PBEAM PBEND PBUSH PBUSH1D PBUSHT PCOMP PCONEAX PCONV PCONVM PDAMP PDAMPF PDAMP5 PELAS PELASF PGAP PHBDY PINTC PINTS PLPLANE PLSOLID PMASS PROD PSHEAR PSHELL PSOLID PSOLIDL PTRIA6 PTUBE VIEW VIEW3D

Type of Data NDDL Name Entries

Page 203: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

195CHAPTER 8Direct Access I/O APIs

Description of Grids generated for p-elements (GRIDN )

GDNTAB GDNTAB

Grid Point Data GEOM1 CORD1C CORD1R CORD1S CORD2C CORD2R CORD2S FEEDGE FEFACE POINT GMCORD GRID* SEBULK SELABEL SELOC SEMPLN SENQSET SEQGP SNORM

Load Data GEOM3 FORCE FORCE1 FORCE2 GMLOAD GRAV LOADCYH LOADCYN LOADCYT LSEQ MOMENT MOMENT1 MOMENT2 PLOAD PLOAD1 PLOAD2 PLOAD3 PLOAD4 PLOADX PLOADX1 PRESAX QBDY1 QBDY2 QBDY3 QHBDY QVECT QVOL RFORCE SLOAD TEMP TEMPD TEMPEST TEMPF TEMPIC TEMPP1 TEMPP2 TEMPP3 TEMPRB PFACE PEDGE

Constraints GEOM4 ASET BSET CSET CYSUP CYSYM EGENDT FCENDT GMBC GMSPC OMIT QSET RBAR RROD RSSCON RTRPLT SEBSET SECSET SEQSET SESUP SEUSET SPC SPCD SPCDE SPCDF SPCDG SPCE SPCEB SPCF SPCFB SPCGB SPCGRID SPCOFF SUPORT TEMPBC USET

DMIG, Fluid and Radiation Data

MATPOOL MFLUID

Material Property Table MPT CREEP MAT1 MAT2 MAT3 MAT4 MAT5 MAT8 MAT9 MAT10 MAT11 MATHP MATS1 MATT1 MATT2 MATT3 MATT4 MATT5 MATT8 MATT9 NLPARM NLPCI TSTEPNL

OUTPUT control for p-element analysis

OINT OUTRCV

Spline Data SPLINE SET2 SPLINE1 SPLINE2 SPLINE4 SPLINE5

Relates each p-element with its view elements

VIEWTB HEXAP PENTAP TETRAP

* Use NServer_ReadXYZ to obtain grid data in Basic coordinate system.

Type of Data NDDL Name Entries

Page 204: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

196

NServer_ReadIFPKeys - Get IFP Card IDs

From FORTRAN:

CALL NSRIKYS

From C:

Purpose. Returns the IFP keys.

Arguments.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

Int NServer_ReadIFPKeys

( char *GrpName, INTEGER Filept, INTEGER *Offset, INTEGER *Record, INTEGER Reclen, INTEGER *NWread, INTEGER *Iret, INTEGER *Error);

GrpName INPUT Group Name for the Server.

Filept INPUT FIST Number for the Data Block.

Offset INPUT/OUTPUT

Last offset for keys returned in Record. A subsequent call to this API with a non-zero offset will return keys from this offset. Offset should be set to zero for the initial call to this API.

Record OUTPUT Location to store values. Record contains the keys for the data block you are requesting keys. Record contains two word keys for the data as

Word 1 - IDWord 2 - Card Number

RecLen INPUT Length of the Record array.

NWread OUTPUT Number of words return in Record.

Iret OUTPUT Error code returned from the Server

0 - OK1 - Problem with the index files2 - RecLen too small NWread contains size required

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 205: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

197CHAPTER 8Direct Access I/O APIs

NServer_ReadIndexedIFP - Get IFP Data

From FORTRAN:

CALL NSRIIFP(...)

From C:

Purpose. Returns indexed IFP data for a given list of IFP keys.

Arguments.

int NServer_ReadIndexedIFP

( char *GrpName, INTEGER Filept, INTEGER *Record, INTEGER Reclen, INTEGER *Ids, INTEGER Idwds, INTEGER *NWread, INTEGER *LastId, INTEGER *Iret, INTEGER OP, INTEGER *Error );

GrpName INPUT Group Name for the Server

Filept INPUT FIST Number for the Data Block

Record OUTPUT Location to store values. Record contains 4 words at the beginning of each tuple returned defining the tuple, plus the tuple. This structure repeats until all the IDs have been returned or Record does not contain enough room to contain another entry. The entry words are:

Word 1 - Length of Tuple (L)

Word 2 - Card Number

Word 3 - Card Name 1

Word 4 - Card Name 2

Word 5 through (L+5) - Card Tuple

RecLen INPUT Length of the Record array

Ids INPUT Ids is a two word list of keys which you want returned. The first word of each entry is the ID and the second is the card number. If the card number is set < 0 then all with the given ID will be returned regardless of the card number. The ID list can be in any order and output will be returned in that order.

Idwds INPUT Length of the Ids array

Nwread OUTPUT Number of words returned in Record

Page 206: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

198

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

LastId INPUT/OUTPUT

Array position within Ids of the last id completed in Record.

The initial call to this API should set LastId to zero.

Note: If all requested Ids cannot be returned because of insufficient space in Record then a nonzero value is output in LastId containing the last ID successfully processed. A subsequent call to this API with this nonzero LastId value will repeat the process of returning values where the previous call left off.

Iret OUTPUT Return code.

Iret =0 OK

Iret = 1, Problem with the index (possibly not indexed)

Iret = 2, Reclen too small.

OP INPUT unused operation code

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Note: NServer_Select may be used to filter these results.

Page 207: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

199CHAPTER 8Direct Access I/O APIs

8.4 Data Recovery API's (OFP Type Datablocks)OFP Datablock Processing

The fundamental requirement of OFP Indexing is to provide the functions necessary to directly access data recovery results from the MSC.NASTRAN database. The function of this API's is to directly access results data (stress, force, strain, displacement, etc.) from the MSC.NASTRAN database given a subcase-loading condition and a set of ids (element, timestep or frequency). The set of ID's can be in any order and can be a variety of different element types. All significant OFP files can be indexed including sort1/sort2 types, the various approaches and the various forms (real, complex, etc).

The NDDL label and type (integer, real, etc) information for the OFP data is also accessible.

How to Index OFP Data

The OFPINDX DMAP module takes an OFP type datablock and creates two associated index files, one associative file to index the OFP id record information and one file to index the ID’s. Three API were written to access the data through these index files, 1) NServer_ReadOFPSubindex, loads the OFP subcase ID information so that a particular subcase-load case can be selected, 2) NServer_ReadOFPKeys, returns OFP key data for a particular subcase, and 3) NServer_ReadIndexedOFP, which returns the results data given the selected subcase and a list of ids. An example of the DMAP call to the new module is shown below.

file oes=append $ofpindx /oes $

The index data is appended onto the base file (e.g, oes) as an "associated file" and as such is invisible to other DMAP modules unless they need the information.

OFPINDX module associates two index files with the OFP datablock (shown above as oes). They are 1) subindex, an index of the subcase (OFP id record) information and 2) eleindex, an index keyed on the element (or frequency or timestep) information. Information for the subindex file is taken from the ID record of the OFP file. It includes information on the OFP file type, the subcase number/load/frequency/timestep, the element type and the format of the data (sort1/sort2) for the next data record. The subindex file condenses this information down to a few words necessary for indexing.

The subindex file (see Appendix H) allows a user to quickly find the subcase or load step they are interested in. This subindex file consists of a single GINO record with fixed length entries containing information necessary to select a particular result case. There is a one-to-one correspondence with the OFP file id records and the subcase index entries.

Page 208: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

200

The eleindex file contains a list of element IDs with the pointers to the locations in the OFP file that contains that element. There is a single element index record for a single subcase or loading condition regardless of the element type. Different element types have been merged into a single element index if the subcase/load combination is the same. This eliminates Element type as a key and is modeled after MSC.Patran which treats element type as an attribute of a particular ID's data.

This means that the IDs in MSC.Nastran model should be unique across all the element types to provide direct access capability to the results data. However, if the element IDs are not unique across the element types then ALL the elements with the same ID are returned (sort 1 data only).

This indexing structure works for sort1 or sort2 output. For sort 1 output the subindex will contain subcase and load information and the eleindex file will have element IDs. For sort2 data this is reversed, the subindex contains a particular element and the eleindex ID is a particular frequency or timestep.

MSC.Nastran solution sequences will index OFP datablocks when the NASTRAN INDEX=OFP (or sys316=2) keword is set. If both IFP and OFP datablocks need to be indexed, then NASTRAN INDEX=IFP+OFP (or sys316=3) is set.

If you do not need to do any MSC.Nastran restart, but just want to save the datablocks necessary for Patran plotting capabilities you can request TDB (Toolkit Database) processing. Here the statement NASTRAN INDEX=IFP+OFP+TDB (or sys316=7) will direct the Patran subset of the IFP and OFP datablocks to MASTER dbset instead of DBALL. You can then delete DBALL dbset (perhaps with the command line argument DELETE=DBALL) and Patran (or your client code) would only need to DBLOCATE data blocks from MASTER to process information. Of course, if you only want OFP information then set NASTRAN INDEX=OFP+TDB, (or sys316=6).

NServer_SelectOFP class of API’s

This API and its associated utility API’s were designed as an alternative and "easier to use" interface than the base API’s. The class of API’s are a set of client-side API’s provided within libclient.a which are designed to eliminate much of the coding required within a Toolkit application which use these earlier API’s.

The application writer is no longer required to: (1) handle the various forms of OFP data (i.e., Sort1/Sort2), (2) understand the differences between internal and external Subcase specifications (user defined external Subcase specifications can be used), (3) handle the processing of this data across multiple databases and multiple datablocks, (4) handle the details of labeling and type definition of the returned data, (5) and finally, handle the issues related to "opening" and "indexing" of the data prior to access-- this is all handled automatically by this and its associated utility API’s. The NServer_SelectOFP class of API’s are an easier alternative to the following;

NServer_ReadOFPSubindex

NServer_ReadOFPKeys

Page 209: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

201CHAPTER 8Direct Access I/O APIs

NServer_ReadIndexedOFP

NServer_NDDLDesc

NServer_OFPDesc

The above five API’s will continue to be available and supported within the Toolkit product--in fact, this NServer_SelectOFP API and its associated utility API’s described below call these five API’s as part of their underlying implementation code.

One of the best features of NServer_SelectOFP is the client can be set up to read through more than one file at a time. Indeed, you can read from more than one file on multiple number of servers. For example, many users set up superelement runs where data is broken up up superelement (and perhaps by data base). Here, NServer_SelectOFP logically concatenates all these files together so the data can be returned as a unit within a single tight client loop.

NServer_SelectOFP and associated API’s allow you to retrieve and label results data accessed from multiple databases, datablocks, loading conditions, and element ID list. Algorithmically your client code uses these API’s by;

1. Calling NServer_GetSubIdList and NServer_GetIdList for the user selected server-datablock combinations. These two calls return the union of the subcase information and the element (or grid) id information contained on these server-datablocks. From this information, the user can choose the Id’s and subcases of interest.

2. At this point you have the option of applying a filter on the data that will be returned (see NServer_Select). You can select which fields are returned, the order within the tuple and apply a where clause test on the fields.

3. A single call made to NServer_SelectOFP with the user specified the server-datablocks, the loading conditions (subcases) and the element ids you wish to retrieve information. In a loop, the client calls;

a. NServer_GetNextEntry to position to the next tuple to be retrieved.

b. NServer_GetLen to get minimum allocation lengths for this entry.

c. NServer_GetData to retrieve the tuples values.

d. various other API’s to get other describing data for the current entry such as NDDL label and type, subcase, and title, subtitle, label information for this entry. Items a-d are repeated for each entry until all data has been returned or the buffered data is freed.

Page 210: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

202

NServer_SelectOFP - Retrieve OFP Results

From FORTRAN:

CALL NSSLOFP(...)

From C:

Purpose. Returns a NServer_SelectOFP handle (SelectOFPId) indentifying a selection of OFP results data across a set of databases and datablocks, a list of requested subcase(s) and ids (elements/grids). The SelectOFPId handle is subsequently used by a set of utility API’s that return the data selected and associated descriptive information.

Arguments.

int NServer_SelectOFP

( char* GrpNameList, INTEGER GrpNameLen, INTEGER *FileptList, INTEGER FileptLen, INTEGER *SubIdList, INTEGER SubIdWds, INTEGER *IdList, INTEGER Idwds, INTEGER *SelectOFPId, char *SortOrder, INTEGER AutoIndex, INTEGER *Iret, INTEGER *Error)

GrpNameList INPUT String of Server Group Names handle’s to process. This list must correspond one-to-one with the FileptList if more than one group name (server) is necessary

GrpNameLen INPUT Length of GrpNameList (256 characters/GrpName)

FileptList INPUT Array of OFP files to process.

FileptLen INPUT Length of FileptList.

SubIdList INPUT Array of subcases to process (4 words/subcase)

Each 4 word entry specifies the user specification for the subcase. The SubIdList content is dependent on the solution sequence. (see Note) The complete SubIdList for a set of datablocks can be retrievedusing NServer_GetSubIdList.

SubIdwds INPUT Length (in words) of SubIdList.

IdList INPUT Array of id(s) you wish to return. This is the list of element Ids or grid Ids depending on the content of the list of datablocks. NServer_GetIdList will return the complete list for a list of datablocks.

IdListLen INPUT Length of the IdList.

SelectOFOId OUTPUT Handle which identifies this request.

SortOrder INPUT Reserved for future use. “sort1” or “sort2”

Page 211: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

203CHAPTER 8Direct Access I/O APIs

Notes:

1. NServer_SelectOFP returns a pointer (SelectOFPId) that can be used to access the OFP data as specified within the supplied list of databases, datablocks and requested Subcase(s) and Element/Grid id’s. If a requested Subcase and/or Element/Grid id is not found in the list of datablocks it is ignored without comment. If an Element/Grid id is not unique in the indexed tables then all of the data (multiple tuples) for this id are processed. If a requested database (GrpName) or file (in FileptList) is empty/purged it is ignored and a warning message is issued.

2. All datablocks in FileptList must be the same sort type (sort1 or sort2)

3. The 1-4 words for the SubcaseID’s (External Subcase Specification) is defined based on the analysis type. See Table 8-1, “Subcase Load words by Analysis Type,” on page 206.

4. If the same GrpName applies to all the datablocks specified in the FileptList array then only the first GrpNameList entry needs to be specified--i.e., in this case it will be assumed that all datablocks specified in the associated FileptList can be found on the same database as specified by the single GrpName value.

5. The output from multiple NServer_SelectOFP calls can be processed concurrently, the results for each call identified by its unique SelectOFPId value.

6. Various support functions (API’s) are listed below which are available to use with this API--The first group of API’s can be used to automate the preparation of the input parameters used to specify the Subcase(s) and Element(s)/Grid(s) to be processed by NServer_SelectOFP

NServer_GetSubIdList--Get a list of the 4 word/entry external Subcases (SubIdList) contained within the requested database(s) (GrpNameList) and datablock(s) (FileptList).

NServer_GetIdList--Get the list of Id’s (element id’s/grid id’s) (IdList) contained within the requested database(s)(GrpNameList), datablock(s)(FileptList) and Subcases (SubIdlist).

7. The second group of API’s are designed to be used after calling NServer_SelectOFP. This group provides access to the data found within the selected record entries and their associated descriptive information. :

AutoIndex INPUT Reserved for future use. =0

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 212: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

204

NServer_GetNextEntry --Advance to next entry within the selected OFP datablocks.

NServer_GetLen--Get the length of the current entry.

NServer_GetData--Get the data (e.g., sx1, sy1-) within the current entry.

NServer_GetLabels--Get the Labels (i.e., NDDL defined,e.g., "sx1","sx2") for the terms in the current entry.

NServer_GetTypes--Get the Types (i.e., integer, real, character-) for the current entry.

NServer_GetDatablkType--Get the type of datablock where the current entry was found (i.e, "table","OFP" -.)

NServer_GetSubcase--Get the pointer into the Subcase list ( SubIdList ) where the current entry was found.

NServer_GetFilept--Get the datablock file pointer (Filept) where the current entry was found.

NServer_GetGrpName--Get the database (GrpName) where the current entry was found.

NServer_RemoveSelectOFP--Remove all internal data structures and close all files associated with the specified NServer_SelectOFP call.

Example.

See codelibrarian.

Page 213: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

205CHAPTER 8Direct Access I/O APIs

NServer_GetSubIdList - Retrieves a List of Subcases-loads

From FORTRAN:

CALL NSOLOAD(...)

From C:

Purpose. Retrieves a array of subcase-load information for a list of datablocks. The list is the union of all the subcase-loads. It consists on 1 four word entry for each unique subcase. The content of each entry is dependent on the sort type of the datablock and the analysis type (a function of the solution sequence).

Arguments.

int NServer_GetSubIdList

( char* GrpNameList, INTEGER GrpNameLen, INTEGER *FileptList, INTEGER FileptLen, INTEGER *SubIdList, INTEGER SubId, INTEGER *NumOfSubs, INTEGER *Iret, INTEGER *Error)

GrpNameList INPUT String of Server Group Names handle’s to process. This list must correspond one-to-one with the FileptList if more than one group name (server) is necessary

GrpNameLen INPUT Length of GrpNameList (256 characters/GrpName)

FileptList INPUT Array of OFP files to process.

FileptLen INPUT Length of FileptList.

SubIdList INPUT Array of subcases to process (4 words/subcase)

Each 4 word entry specifies the user specification for the subcase. The SubIdList content is dependent on the solution sequence. (see Note NServer_SelectOFP) The complete SubIdList for a set of datablocks can be retrieved using NServer_GetSubIdList. See Table 8-1, “Subcase Load words by Analysis Type,” on page 206.

SubIds INPUT Maximum number of subcases in SubIdList.

NumOfSubs OUTPUT Actual Number of subcases used in SubIdList.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 214: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

206

Table 8-1 Subcase Load words by Analysis Type

Analysis Word 1 Word 2 Word 3 Word 4

Statics Subcase Load Set Undefined Undefined

Modes Subcase Mode Eigenvalue Mode or cycle

Differential Stiffness

Subcase Load Set Undefined Undefined

Frequency Subcase Frequency Undefined Undefined

Transient Subcase Time Undefined Undefined

Buckling Subcase Load Set Undefined Undefined

Complex Eigenvalues

Subcase Mode Real Eigen Imag Eigen

Nonlinear Statics

Subcase Load Set Undefined Undefined

Sort2 Subcase Undefined Undefined Undefined

Page 215: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

207CHAPTER 8Direct Access I/O APIs

NServer_GetIdList - Retrieves a List of IDs

From FORTRAN:

CALL NSOIDS(...)

From C:

Purpose. Retrieves a list of ids from one or more indexed OFP datablocks. The ids may be grid and/or element IDs depending the contents of the OFP datablocks. Duplicate id’s are removed.

Arguments.

int NServer_GetIdList

( char* GrpNameList, INTEGER GrpNameLen, INTEGER *FileptList, INTEGER FileptLen, INTEGER *SubIdList, INTEGER NumOfSubs, INTEGER *IdList, INTEGER IdLen, INTEGER *IdLenOut, INTEGER *Iret, INTEGER *Error )

GrpNameList INPUT String of Server Group Names handle’s to process. This list must correspond one-to-one with the FileptList if more than one group name (server) is necessary

GrpNameLen INPUT Length of GrpNameList (256 characters/GrpName)

FileptList INPUT Array of OFP files to process.

FileptLen INPUT Length of FileptList.

SubIdList INPUT Array of subcases to process (4 words/subcase)

Each 4 word entry specifies the user specification for the subcase. The SubIdList content is dependent on the solution sequence. (see Note NServer_GetSubIdList) The complete SubIdList for a set of datablocks can be retrieved using NServer_GetSubIdList.

NumOfSubs INPUT Number of subcase entries in SubIdList.

IdList OUTPUT Array of ID(s). This is the list of element IDs or grid Ids depending on the content of the list of datablocks.

IdOut INPUT Maximum Length of the IdList.

IdLenOut OUTPUT Length of IdList used.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 216: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

208

NServer_GetNextEntry - Advance to Next SelectOFP Entry

From FORTRAN:

CALL NSONEXT(...)

From C:

Purpose. Move to the next entry for this SelectOFP.

Arguments.

Note:

1. NServer_SelectOFP does not preposition at the first entry. The first call to NServer_GetNextEntry positions at the first entry.

int NServer_GetNextEntry

( INTEGER SelectOFPId, INTEGER *Iret, INTEGER *Error )

SelectOFPId INPUT SelectOFP handle.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 217: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

209CHAPTER 8Direct Access I/O APIs

NServer_GetLen - Get Length

From FORTRAN:

CALL NSOLEN(...)

From C:

Purpose. Get length of the labels, number of terms and the number of words of the current entry.

Arguments.

Notes:

1. Lengths are adjusted in accordance with NServer_Select statements.

2. Lengths will only be given for datablocks which are described in the NDDL or who’s root datablock can be determined from the current datablock’s ACODE and TCODE variables..

int NServer_GetLen

( INTEGER SelectOFPId, INTEGER* Nwds, INTEGER* NTerms, INTEGER* LLabel, INTEGER* Iret, INTEGER* Error )

SelectOFPId INPUT SelectOFP handle.

Nwds OUTPUT number of words of the current entry

NTerms OUTPUT number of terms (fields) of the current entry.

LLabel OUTPUT number of characters needed for the NDDL description label.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 218: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

210

NServer_GetData - Get Entry Data

From FORTRAN:

CALL NSODATA(...)

From C:

Purpose. Get length of the labels, number of terms and the number of words of the current entry.

Arguments.

Note:

1. Entry data can be filtered by NServer_Select.

int NServer_GetData

( INTEGER SelectOFPId, INTEGER *Tuple, INTEGER *Iret, INTEGER *Error )

SelectOFPId INPUT SelectOFP handle.

Tuple OUTPUT current entry’s data. Length of this array must be at least NServer_GetLen’s Nwds.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 219: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

211CHAPTER 8Direct Access I/O APIs

NServer_GetLabels - Get Entry NDDL Description

From FORTRAN:

CALL NSOLABL(...)

From C:

Purpose. Get the NDDL description for the current entry.

Arguments.

Note:

1. Output can be filtered by NServer_Select.

int NServer_GetLabels

(INTEGER SelectOFPId, char* Blockname, char* Label, INTEGER *Iret, INTEGER *Error )

SelectOFPId INPUT SelectOFP handle.

Blockname INPUT Name of the datablock who’s NDDL datablock is to be used. Normally this can be set to a blank character string. This argument isrequired only when the description cannot be determined from internal contents of the datablock.

Label OUTPUT This entries NDDL description. Each field of the tuple is labelled with 1-8 chars delimeted by a comma.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 220: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

212

NServer_GetTypes - Get Entry’s NDDL Types

From FORTRAN:

CALL NSOTYPE(...)

From C:

Purpose. Get the NDDL description for the current entry.

Arguments.

Note:

1. Output is filtered by NServer_Select.

int NServer_GetTypes

( INTEGER SelectOFPId, char* Blockname, INTEGER *Types, INTEGER *Iret, INTEGER *Error )

SelectOFPId INPUT SelectOFP handle.

Blockname INPUT Name of the datablock who’s NDDL datablock is to be used. Normally this can be set to a blank character string. This argument isrequired only when the description cannot be determined from internal contents of the datablock.

Types OUTPUT Type array for the current entry.

Array (1 Integer word per entry) where;=1, integer=2, real single precision=3, hollerith=4, real double precision=5, complex single precision=6, complex double precision=7, logical=15, real machine precision=16, complex machine precision=99, undefined

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 221: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

213CHAPTER 8Direct Access I/O APIs

NServer_GetDatablkType - Get Entry’s Datablk Type

From FORTRAN:

CALL NSODBTY(...)

From C:

Purpose. Get the type of datablock for the current entry.

Arguments.

int NServer_GetDatablkType

( INTEGER SelectOFPId, char *BlockName, INTEGER *DatablkType, char *TableType, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

Blockname INPUT Name of the datablock who’s NDDL datablock is to be used. Normally this can be set to a blank character string. This argument isrequired only when the description cannot be determined from internal contents of the datablock.

DatablkType OUTPUT Datablock type code.

TableType OUTPUT Datablock type. (8 characters)

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 222: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

214

NServer_GetSubcase - Point to Entry’s SubIdList Data

From FORTRAN:

CALL NSOSUBC(...)

From C:

Purpose. Point to this entry’s SubIdList.

Arguments.

Note:

1. The following equations describes the location of the first word of the 4-word entry within SubIdList as pointed by SubIdListEntry:

For FORTRAN:

offset=(SubIdListEntry-1)*4 + 1

For C:

offset=(SubIdListEntry-1)*4

int NServer_GetSubcase

(INTEGER SelectOFPId, INTEGER* SubIdListEntry, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

SubIdListEntry OUTPUT The entry number within the SubIdList for the current NServer_GetNextEntry.

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 223: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

215CHAPTER 8Direct Access I/O APIs

NServer_GetFilept - Get Entry’s Datablock File

From FORTRAN:

CALL NSOFILE(...)

From C:

Purpose. Get the datablock file handle for the current entry.

Arguments.

int NServer_GetFilept

(INTEGER SelectOFPId, INTEGER *Filept, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

Filept OUTPUT Datablock file handle for the current entry

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 224: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

216

NServer_GetGrpName - Get Entry’s Server Handle (GrpName)

From FORTRAN:

CALL NSOGRPN(...)

From C:

Purpose. Get the server handle (GrpName) for the current entry.

Arguments.

int NServer_GetGrpName

(INTEGER SelectOFPId, char* GrpName, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

GrpName OUTPUT GrpName of the current entry. (max 256 characters)

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 225: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

217CHAPTER 8Direct Access I/O APIs

NServer_GetOFPLabel - Get Entry’s Title, Subtitle, Label

From FORTRAN:

CALL NSOGLBL(...)

From C:

Purpose. Get the Case Control Title, Subtitle and Label for the current entry.

Arguments.

int NServer_GetOFPLabel

(INTEGER SelectOFPId, char* Title, char* Subtitle, char* Label, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

Ttitle OUTPUT Ttitle of the current entry’s subcase. (129 characters)

Subtitle OUTPUT Subtitle of the current entry’s subcase. (129 characters)

Label OUTPUT Label of the current entry’s subcase. (129 characters)

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 226: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

218

NServer_GetSubIndex - Get Entry’s SubIndex Data

From FORTRAN:

CALL NSOSUBI(...)

From C:

Purpose. Get current entry’s 16 word subindex data. The subindex data provides data block typing information including analysis type, length of tuple, type of sort, etc. (See “NServer_ReadOFPSubindexEntry - Get One OFP Subindex Entry” on page 243.)

Arguments.

int NServer_GetSubIndex

(INTEGER SelectOFPId, INTEGER *SubIndex, INTEGER *Iret, INTEGER *Error)

SelectOFPId INPUT SelectOFP handle.

SubIndex OUTPUT Subindex array (16 words, see Appendix H)

Iret OUTPUT Return flags.

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 227: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

219CHAPTER 8Direct Access I/O APIs

NServer_RemoveSelectOFP - Frees SelectOFP

From FORTRAN:

CALL NSRSLOF(...)

From C:

Purpose. Frees memory allocated by NServer_SelectOFP.

Arguments.

int NServer_RemoveSelectOFP

(INTEGER SelectOFPId, INTEGER* Error)

SelectOFPId INPUT SelectOFP handle.

Func. Ret. OUTPUT Server return error flag.

Page 228: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

220

Base Set of Indexed OFP Api’s

Summary of How to Use the base set of OFP API's

1. The DMAP must have a call to module OFPINDX for all the OFP datablocks you will be calling with the OFP API. OFPINDX indexes the data block and stores the index information for later use. Typically you will want to index OES1 (stress), OEF1i (force), OESTR1 (strain) data blocks. These datablocks must be stored permanently.

2. Current solution sequences will make the indexes by placing a NASTRAN INDEX=OFP card in input deck (or specifying sys316=2 as a keyword on the Nastran command submittal) and running your jobs with scr=no or scr=mini.

3. Assuming the client code has performed the normal startup API calls, the client next allocates the appropriate OFP data block (see NServer_AllocDatablk).

4. Call NServer_ReadOFPSubindex to return all the subcase/element type combinations (see Appendix H for a description of the attributes). Choose the subcase you are interested in from the subindex table (any entry with the correct subcase even if you have multiple element types).

5. Pass the subindex entry number for this subcase into NServer_ReadOFPKEYS to retrieve the key information for the subcase.

6. Open the data block with NServer_OpenDatablk.

7. Pass the subindex entry number for this subcase into NServer_ReadIndexedOFP and a list of id's you want retrieved into NServer_ReadIndexedOFP to extract the recovery results.

For each ID returned you can get the first word of the Record returned.

This is the subindex entry number for the first ID. Use the subindex entry number to find the element type and number of attributes (lrecl) for this ID. Use lrecl to position to next ID within the data Record.

Use the subindex entry number to get the iapr, iform, table, etc. codes from the 16 words returned for this subindex entry. Pass this information with the data block name to NServer_NDDLDesc to get the NDDL label and type information for this ID. You can use an alternative function to NServer_NDDLDesc called API NServer_OFPDesc. This one allows you to simply provide a pointer to the subindex entry instead of explicitly providing the NDDL label and type information.

For a detailed example that demonstrates the use of these direct access OFP API's see the NSbrowser.f example in the "Toolkit Code Librarian" Help system.

Page 229: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

221CHAPTER 8Direct Access I/O APIs

NServer_Select - Define a Filter for Datablock Attributes Prior to Performing I/O Activities

From FORTRAN:

CALL NSSELEC (...)

From C:

Purpose. To define a filter for a datablock record prior to performing I/O activities.

Arguments.

int NServer_Select

( char* GrpName, char *Select , INTEGER* SelectId, INTEGER Tolerance, INTEGER *Iret, INTEGER *Error )

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

Select INPUT A select statement with the following format:

"select(attribute_names...) [where(where expression) relation( [fist='fistno'] [record='recordname'] [recordno=eltype or cardno] [datablock='datablk_name'] [type='typename'] [typeno=type] [acode=acode] [tcode=tcode] [scode=scode] [acflag=acflag][thermal=thermal][numwde=numwde] [keyname=ELEINDEX|SUBINDEX])]"

where:expression is a logical expression that specifies the desired values of

the attribute_names.'fistno' is the integer GINO fist number for the datablock that the

Select statement filter will apply.'recordname' is the character string name of the card/element type

(e.g., 'HEXA','CBAR','PBAR')eltype is the integer internal element type for an OFP type datablock.

Specifically, it is the third word returned from a call to Nserver_ReadSubindex.

cardno is the integer internal element number for an IFP type datablock. Specifically, it is the word returned from a call to Nserver_ReadIfpKeys.

datablock_name is the character string name of the datablock (e.g., 'OES1', 'EPT')

Page 230: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

222

Notes.

1. Schema definitions are described in MSC.Software's NDDL (Nastran Data Definition Language). Use the Field names in the NDDL as attributes for selection. select(*) is the default for all relations.

2. NServer_OFPSubindex should be called after NServer_Select calls in order to have the data returned from NServer_OFPSubindex reflect changes/filtering that occur as a result of processing the NServer “Select statement”.

3. The Select statement syntax is similar to the NServer_Dbdict input request string (DBdicString). (see also the Quick Reference Guide description of DBDICT). In the absence of a select clause all attributes are returned in NDDL order.

4. An attribute name within the select clause is ignored if it does not match an attribute name in the NDDL description. For example select(nothing) will cause all attributes for the given relation to be ignored. Use this form of the select to exclude relations.

Select (cont.)

INPUT(cont.)

'typename' is the character string datablock type (e.g., 'IFP','OFP','MATRIX',…)

type is the integer internal datablock type corresponding to the above 'typename' values. Specifically, it is the typeno value returned from a call to Nserver_NDDLDesc.

Acode, tcode, scode, thermal, acflag,numwde are integer values representing the analysis, table, sort, thermal, acoustic or number of words per entry codes respectively of the OFP relation. They are contained in the NDDL description documentation for the OFP datablock and are returned by NServer_ReadOFPSubindex (see Appendix H: Subindex description).

Keyname=eleindex or keyname=subindex point to selects made on the element or subindex index files. See Notes

SelectId OUTPUT A unique identifier associated with this Select statement

Tolerance INPUT For future use. The number of digits of accuracy.

Iret OUTPUT Return Code. For Non-Zero values see output from NServer_GetMessage (p. 49)

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 231: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

223CHAPTER 8Direct Access I/O APIs

5. You may specify each attribute in the schema in any order in the select clause. The terms will be returned in that order. If the attribute name is not unique within the NDDL (used in several fields of the same relation) then all fields of that attribute name will be returned.

6. The filter set by each NServer_Select will be applied to any subsequent I/O performed using either Nserver_ReadIndexedIFP or Nserver_ReadIndexedOFP which match the relation terms.

7. If an attribute name in the where clause does not match one of the attributes in the NDDL description, then this relation is not returned.

8. If an attribute name in the where clause is not unique then the where test is done on the last field of that name in the NDDL.

9. If a where clause is not syntactically correct then the where clause is ignored. Any select clause for this relation will still be processed.

10. attribute names of NULL + I, RS, RD, RX, CS, CD, CX, LOG, CHAR (for example ‘NULLRS’) will add a zero of the indicated type to the output for this relation.

11. A filter can be removed by NServer_RemoveSelect.

12. Nserver_Select are matched with relations are they are being read by Nserver_ReadIndexedIFP or Nserver_ReadIndexedOFP. For Nserver_ReadIndexedIFP FIST, DATABLK, TYPE, TYPENO, RECORDNO or RECORD are used in the selection. For Nserver_ReadIndexedOFP FIST, DATABLK, TYPE, TYPENO, RECORDNO or ELTYPE, ACODE, TCODE, SCODE, FCODE, ACFLAG, NUMWDE are used in the selection. Bold-face keywords are the minimum and are usually enough (but not always) to uniquely specify a relation for a single MSC.Nastran Project/Version.

13. Items contained in the relation clause (datablk, tcode, etc.) are used to specify the relation this select and where clause are to apply. Terms necessary to fully select relation but are absent from the relation clause are assumed to be wildcarded, that is, will match anything.

14. Only one Nserver_Select is allowed for a particular relation clause. If another having the same set of relation keyword and values as a previously defined one, then the old one is removed.

15. keyname=eleindex is used to provide a filter on a datablocks Element index table. At the present time, only the grid point force table (TCODE=19) allows filtering the element index. The eleindex section of the grid point table consists of 4 words (EKEY, FLAG, EPOS1, EPOS2) where ekey is the grid id, flag is either the element id, or a flag indicating ‘SPC’, ‘MPC’, ‘APPLIED LOADS’ or ‘TOTAL’. The default select for grid point forces is select(EKEY,POS1,POS2), relation(tcode=19, keyname=eleindex) which has the effect of removing the FLAG word from the keys returned by NServer_ReadOFPKeys or processed within NSever_ReadIndexedOFP. If FLAG is added to this select these API’s will process two-word keys

Page 232: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

224

16. keyname=subindex is used to provide a filter on the NServer_ReadOFPSubindex API (does not affect NServer_ReadOFPSubIndexEntry). Normally this API returns 16-word entries as described in Appendix H. However, you may change the default to any of the normal 146-words of an OFP Id record (labeled ID1-ID146) plus fields given in the table below. Default select for an OFP subindex table is

’SELECT(SPOS1,SPOS2,ID3,ID4,ID5,ID6,ID7,ID10,ID1,ID23,ID2,ID11,ID13,EENTRY,EPOS1,EPOS2),RELATION(KEYNAME=SUBINDEX)’

Example.

1. Set a filter so that only the attributes sx1, sx2 are returned when sx1 is less than 1.0E03. This filter will apply to all subsequent calls to Nserver_ReadIndexedOFP referencing QUAD4 element results (eltype=33) from GINO file 101.

‘select(sx1, sy1) where (sx1 < 1.0E03) relation( FIST=101,eltype=33,datablk=’OES1’)’

Note that a subsequent call to Nserver_ReadIndexedOFP will return two values (sx1 and sy1) for each referenced QUAD4 element having an sx1 values less than 1.0E03.

2. Allow two-word key processing for Grid Point Forces. Reduce the keys to process APPLIED LOAD grid points. When this select is in effect two-word keys will be returned by NServer_ReadOFPKeys and these two-word keys will be required by NServer_ReadIndexedOFP.

‘select(ekey,flag,pos1,pos2), relation(tcode=19, keyname=eleindex), where(flag=-1)’

3. Get a list of all the subcase numbers (ID4) for a OFP datablock.

‘select(subi,ID4),relation(keyname=subindex)’

Table 8-2

Field Name Description

SUBI Subindex entry number.

SPOS1 Filpos pointer to the Id record.

SPOS2 Filpos pointer to the Id record

EENTRY Number of entries (keys) for this subindex.

EPOS1 Filpos pointer to the element index.

EPOS2 Filpos pointer to the element index.

Page 233: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

225CHAPTER 8Direct Access I/O APIs

NServer_ReadOFPSubindex now returns two word entries of SUBI (subindex entry number), ID4 (subcase number) instead of the default 16 words.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

Page 234: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

226

NServer_SetSelectGroup - Set or Switch SelectGroup.

From FORTRAN:

NSSELGR

From C:

Purpose. Activate a set of select clauses.

Arguments.

Notes. Before a SelectGroup is changed the current group is written to NSSELEC datablock.

After the current group has been written to the database, the NSSELEC datablock (qualified with selgrp and grpnum) are loaded to be used. Any changes to the selects will be made to this group.

Switching often between groups should be avoided. Each select which is referenced during a indexed OFP or IFP Read will be recompiled after a change in groups. Overhead in reading the NDDL Description information can add up if done a significant number of times.

Default selgrp = ' ' (8 blank characters), grpnum=0.

Example. See “Toolkit Code Librarian” nsbrowsr example.

int NServer_SetSelectGroup

(char*GrpName, char*selgrp, INTEGER grpnum, INTEGER * iret, INTEGER *Error) ;

GrpName INPUT Sever handle

Selgrp INPUT Group name (max length 8 characters)

grpnum INPUT Group Number

Iret OUTPUT Return code:

0 = OK

>0 = various codes from ldnssel (load selects) or from wrnssel (write selects) iret = 100*iret wrnssel + iret ldnssel

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 235: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

227CHAPTER 8Direct Access I/O APIs

NServer_SortSelect - Sort NServer_Select to User Input Order or to Default Order

From FORTRAN:

CALL NSSORSL (...)

From C:

Purpose. Sort Nserver_Select to user input order.

Arguments.

Note.

The default is to order NServer_Select statements with relations containing record attributes (record, recordname, or eltype) first, followed by datablk, then type, then fist. All fields containing wildcards (relation attributes left unspecified) are ordered last. If multiple relation attributes are given, then the more specific NServer_Select is chosen over one that is less specific. For example, if the following two selects are input:

relation(record=grid),select(id,x1)relation(datablk=geom1s record=grid),select(id,x1,x2,x3)

the, when reading the GRID record of GEOM1S, results would be filtered by select(id,x1,x2,x3) since its relation is more specific.

If user ordering was chosen, results would be filtered by select(id,x1) as it was input first.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_SortSelect

( char* GrpName, INTEGER SortCode, INTEGER *Iret, INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

SortCode INPUT SortCode=0. Use user input order of the Nserver_Select clauses. SortCode=1, use default order.

Iret OUTPUT Return Code. For Non-Zero values see output from NServer_GetMessage (p. 49)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 236: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

228

NServer_GetSelect - Get an NServer_Select statement Given its Number

From FORTRAN:

NSGETSL

From C:

Purpose . Return a select for given select number.

Arguments.

Notes. The output string "select" is not an exact replica of the string given when adding the select clause with NServer_Select, but is a representation of the compiled information. It differs from the original string in the placement and delimiters of the "SELECT, RELATION, and WHERE" clause. In addition, the WHERE clause is blanked to prevent repeated error messages if an error is found during it’s first use.

Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_GetSelect

( char*GrpName, INTEGER selno, char* select, INTEGER

maxlen, INTEGER *lenout, INTEGER *iret, INTEGER *Error);

GrpName INPUT Group Name for the Server.

selno INPUT Select number

select OUTPUT Select clause

maxlen INPUT Maximum length given to select

lenout OUTPUT Length of select clause. If iret=2 lenout is the length required

iret OUTPUT Return codes

0 = OK

1= problem reading selects

2 - did not fit, maxlen <estchr (see estchr for length needed)

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 237: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

229CHAPTER 8Direct Access I/O APIs

NServer_RemoveSelect - Remove a Filter Set by a Previous Call to NServer_Select

From FORTRAN:

CALL NSREMSL (...)

From C:

Purpose. Removes a select filter for a datablock set by a previous call to NServer_Select.

Arguments.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_RemoveSelect

( char* GrpName, INTEGER SelectId, INTEGER *Iret, INTEGER *Error );

GrpName INPUT A unique identifier for the Client/Server communication. (Max. 256 chars.)

SelectId INPUT A unique identifier associated with a previous call to NServer_Select. The select statement (filter) associated with this id will be removed. If SelectId < 0 then all NServer_Select are removed.

Iret OUTPUT Return Code. 0=OK

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 238: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

230

NServer_NDDLDesc - Get NDDL Labels and Types

From FORTRAN:

CALL NSNDDLD(...)

From C:

Purpose. Returns the type and label information for a NDDL described table. NDDL word type and label information can be accessed through NServer_NDDLDesc. Datablock name, Element type, table code, approach code, from information contained in the subindex table is passed to NServer_NDDLDesc. NServer_NDDLDesc will read the NDDL descriptions and returns:

• Type of datablock, that is TABLE, VECTOR, MATRIX, IFP, OFP. (Currently only OFP and IFP datablock types return word type and label information).

• comma delimited character string of labels.

• Integer array of typing information.

There is a one-to-one correspondence with the data returned from the indexed OFP file, the label string and the type information.

For OFP datablocks, you can use an alternative function to NServer_NDDLDesc called NServer_OFPDesc. This API allows you to provide a pointer to the subindex entry instead of explicitly providing the NDDL label and type information contained in the subindex table.

Arguments.

int NServer_NDDLDesc

( char *GrpName, char *BlkName, INTEGER *blktype, char *glbstr, INTEGER *glbnum, INTEGER lglbnum, char *label, INTEGER llabel, INTEGER *nlabel, INTEGER *type, INTEGER ltype, INTEGER *ntype, INTEGER *iret, INTEGER *Error );

GrpName INPUT Group name.

BlkName INPUT NDDL name of datablock you wish described.

Page 239: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

231CHAPTER 8Direct Access I/O APIs

Blktype OUTPUT Numeric NDDL datablock type 1 table 2 vector- not implemented 3 matrix 4 unstructured 5 IFP table 6 case control 7 KELEM and similar datablocks) 8 KKDICT and similar datablocks) 9 DMI datablocks10 bulk data current TABL11 PVT datablock12 OFP table13 unknown datablock*Note that only type 5 and 12 datablocks currently supported by this API. Support for others will be added in a future release.

glbstr INPUT Comma/space delimited list of Global variable names (NDDL type 2 parameters). See Notes

glbnum INPUT Values associated with each global Array variable name in GLBSTR.

lglbnum INPUT Length of glbnum.

label OUTPUT String of NDDL-defined labels (comma delimited, no delimiter following last label).

llabel INPUT Length of supplied LABEL string.

nlabel OUTPUT Length of used LABEL string<= LLABEL, number of characters returned= 0, nothing returned< 0, LLABEL words returned number of additional characters required

Page 240: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

232

type OUTPUT Table of NDDL-defined typesArray (1 Integer word per entry) where;=1, integer=2, real single precision=3, hollerith=4, real double precision=5, complex single precision=6, complex double precision=7, logical=15, real machine precision=16, complex machine precision=99, undefined

ltype INPUT Length of supplied TYPE array.

ntype OUTPUT Returned words in TYPE array<= LTYPE, number of words returned= 0, nothing returned< 0, LTYPE words returned number of additional words required

iret OUTPUT Return Code. The return codes 1-4, 101-102, and 208-209 are fatal flaws. *0 okay1 no NDDL description 2 unsupported NDDL type 3 no NDDL description 4 insufficient opencore for NDDL (need to increase mem=) *5 Neither types nor labels requested6 insufficient client-supplied space for LABELs7 insufficient client-supplied space for TYPEs8 insufficient client-supplied space for LABELs/TYPES101 couldn’t locate ITENT record in NDDL102 invalid NDDL code type in IDENT record201-207 insufficient opencore (need to increase mem=)208 couldn’t locate DATA record in NDDL209 unmatched EITHER/OR condition in NDDL300-308 insufficient client-supplied space for Label or Types501-507 insufficient opencore (need to increase mem=)

Page 241: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

233CHAPTER 8Direct Access I/O APIs

Notes.

1. For IFP datablocks a Blkname string of ‘datablockname:cardname’ (for example ‘GEOM1:GRID’)’ is sufficient to access the NDDL Descriptions. Variable glbstr = ‘ ‘ (blank), and glbnum and lglbnum are zero.

2. NDDL type 2 parameters are those variables defined by a(C). They consist of

glbstr=’ACODE ELTYPE TCODE SCODE THERMAL NUMWDE ACFLAG’

for the union of all OFP datablocks. The values associated with each of these parameter names (input with the array variable glbnum) can be extracted from an subindex entry read by NServer_ReadOFPSubindex.

3. NServer_Select selects clause also filters the Label and Type.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 242: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

234

NServer_OFPDesc - Get NDDL Labels and Types

From FORTRAN:

CALL NSOFPDE(...)

From C:

Purpose. Returns the type and label information for an NDDL described table.

Note. NServer_OFPDesc is the same as NServer_NDDLDesc except that the three arguments (char *glbstr, INTEGER *glbnum, INTEGER lglbnum) have been replaced with a simplified calling method that only requires a pointer to the SubIndex array (subIndex) for the datablock of interest. See NServer_NDDLDesc (p. 230) for a complete description of the output variables. See NServer_ReadOFPSubindex (p. 241) for a description of the subindex entry.

int NServer_OFPDesc

( char *GrpName, char *BlkName, INTEGER *Blktype, INTEGER *subIndex, char *label, INTEGER llabel, INTEGER *nlabel, INTEGER *type, INTEGER ltype, INTEGER *ntype, INTEGER *iret, INTEGER *Error );

Page 243: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

235CHAPTER 8Direct Access I/O APIs

NServer_ReadIndexedOFP - Get Results

From FORTRAN:

CALL NSRIOFP(...)

From C:

Purpose. Returns the OFP results data given a subindex entry number and a list of ids.

Arguments.

int NServer_ReadIndexedOFP

(char *GrpName, INTEGER Filept, INTEGER *Record, INTEGER Reclen, INTEGER SubId, INTEGER *Ids, INTEGER Idwds, INTEGER *NWread, INTEGER *LastId, INTEGER *Iret, INTEGER OP, INTEGER *Error );

GrpName INPUT Group Name for the Server.

Filept INPUT FIST Number for the Data Block.

Record OUTPUT Location to store values.

Reclen INPUT Length of the Record array

SubId INPUT Subindex entry number of the subcase you wish to return.

Ids INPUT Array of ids you wish to return.

Idwds INPUT Length of the Ids array.

NWread OUTPUT Number of words return in Record.

LastId INPUT-OUTPUT

Array position within IDs of the last ID completed in Record.

The initial call to this API should set LastId to zero.

Note: If all requested IDs cannot be returned because of insufficient space in Record then a nonzero value is output in LastId containing the last ID successfully processed. A subsequent call to this API with this nonzero LastId value will repeat the process of returning values where the previous call left off.

Iret OUTPUT Return code.

0 - OK

1 - Problem with the index files

2 - Could not complete request. Record is too small. Use last ID to fill a new ID list for subsequent calls.

Page 244: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

236

Notes.

1. NServer_ReadIndexedOFP returns in Record the list of requested ID's and data as filtered by NServer_Select.

2. If a requested ID is not found in the indexed table it is ignored without comment.

3. If an ID is not unique in the indexed table then all of the data (multiple tuples) for this ID is returned.

4. Each of the recovered tuples is preceded with a single word giving the subindex entry number that this recovered data is associated with. This subindex entry can then be used to find the element type number, the length of the tuple and the NDDL description attributes associated with this ID (see the data description for the subindex in Appendix H).

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

OP INPUT Unused operation code.

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 245: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

237CHAPTER 8Direct Access I/O APIs

NServer_ReadOFPKeys - Get OFP IDsFrom FORTRAN:

CALL NSROKYS(...)

From C:

Purpose. Returns OFP key data for a particular subindex entry.

Arguments.

Notes.

1. For sort 1 data blocks the keys are the element ids for stress, strain and forces and grid points for the displacements.

2. For Grid Point Force Datablock (TCODE=19) keys are the gridpoints. It is optionally possible to return a second key for this datablock. The FLAG key can be selected by the NServer_Select API. FLAG contains either Element Id or Applied Loads (FLAG=-1), SPC Forces (FLAG=-2), MPC Forces (FLAG=-3), Totals (FLAG=-4). See NServer_Select.

int NServer_ReadOFPKeys

( char *GrpName,INTEGER Filept, INTEGER Subc, INTEGER *Offset, INTEGER *Record, INTEGER Reclen, INTEGER * NWread, INTEGER *Iret, INTEGER *Error);

GrpName INPUT Group Name for the Server.

Filept INPUT FIST Number for the Data Block.

Subc INPUT Subindex entry number of subcase of interest.

Offset INPUT/ OUTPUT

Last offset for keys returned in Record. A subsequent call to this API with a non-zero offset will return keys from this offset. Offset should be set to zero for the initial call to this API.

Record OUTPUT Location to store key values.

Reclen INPUT Length of the Record array.

NWread OUTPUT Number of words returned in Record.

Iret OUTPUT Error code returned from the Server.

0 - OK

1 - Problem with the index files

2 - RecLen too small NWread contains size required

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 246: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

238

3. For sort 2 data blocks results are the transpose of the sort 1 form. In sort2 the keys are the load case or time step or frequency. Element numbers are contained in the subindex table in the subcase word (see Appendix H: Subindex description).

4. If Record is not big enough to hold all the keys the call to the API returns with iret = 2.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

Page 247: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

239CHAPTER 8Direct Access I/O APIs

NServer_ReadOFPLabel - Get Title, Subtitle, Label

From FORTRAN:

CALL NSROFPL(...)

From C:

Purpose. Extracts theCase control title, subtitle or label information from the ID record of an OFP datablock.

Arguments.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

int NServer_ReadOFPLabel

( char*GrpName, INTEGER Filept, char*Select, INTEGER Subc, INTEGER * Record, INTEGER Reclen, INTEGER * Nwds, INTEGER * Iret, INTEGER * Error);

GrpName INPUT Group name, the Server's unique identifier.

Filept INPUT Gino file number.

Select INPUT Attribute to be returned.

Valid Attributes are: “title”,”subtitle”, or “label”

Subc INPUT Subindex record number of the idrecord selected.

Record OUTPUT Output Area.

Reclen INPUT Length given to Record. (A complete label requires 32 words.)

Nwds OUTPUT Length used.

Iret OUTPUT Return code.

0 = OK

1 = Problem reading this datablock’s index

3 = Subc not valid

Error OUTPUT Server return error flag.

Func. Ret. OUTPUT Server return error flag.

Page 248: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

240

NServer_ReadOFPLabelC - Read Title, Subtitle, and Label Items from the OFP ID Record

From FORTRAN:

NSROLBL

From C:

Purpose. Read the Case Control title, subtitle, and label items from the OFP ID record for a given Subc Subindex number.

Arguments.

int NServer_ReadOFPLabelC

( char *GrpName, INTEGER Filept, INTEGER Subc, char *title, char *subtitle, char *label, INTEGER *Iret, INTEGER *Error);

GrpName INPUT (Max Length = 256) Group name, the Server's unique identifier

Filept INPUT File number

Subc INPUT Subindex record number of the idrecord selected.

Title OUTPUT Ttitle string. (Minimum length=129)

Subtitle OUTPUT Subtitle string. (Minumum length=129)

Label OUTPUT Label string. (Minimum length=129)

Iret OUTPUT Return code

0 = OK

1 = problem reading the index for this filept

3 = Subc not valid

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag

Page 249: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

241CHAPTER 8Direct Access I/O APIs

NServer_ReadOFPSubindex - Get OFP Identification Information

From FORTRAN:

CALL NSROSUB(...)

From C:

Purpose. Returns a condensed view of the OFP id record(s) with information that includes subcase, element type and various flag words that define the associated data record(s).

Arguments.

Application Note. OFP data blocks consist of a set of two records that group the output data. The first of the two records is a 146 word OFP id record. It contains a number of flag words that describes the data record and also contains subcase and element type information. The second record contains the data. This two record group is repeated until all the element types for each subcase has been written, then repeated for all the subcases. In pseudo code it is

int NServer_ReadOFPSubindex

( char *GrpName, INTEGER Filept, INTEGER *Record, INTEGER Reclen, INTEGER *NWread, INTEGER *Iret, INTEGER *Error );

GrpName INPUT Server Group Name.

Filept INPUT Data Block File Number (see NServer_AllocDB).

Record OUTPUT Location to store values. One 16 word entry is returned for each OFP id record. For statics sort1 data there is one entry for each element type within a subcase times the number of subcases. (See description for this entry (referred to as subindex) in Appendix H).

Reclen INPUT Length of the Record array.

NWread OUTPUT Number of words return in Record.

Iret OUTPUT Error code returned from the Server

0 - OK

1 - Problem with the subcase index file

2 - RecLen too small. NWread contains size required

Error OUTPUT Server return error flag

Func. Ret. OUTPUT Server return error flag.

Page 250: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

242

Sort 1 Dataforeach subcase=1,nosubs {

foreach element_type=1,notypes { #for element datawrite id recordwrite data record # all elements or grids

}}Sort 2 Dataforeach subcase=1,nosubs { # usually one subcase

foreach element_number=1,noelements { #selected elementswrite id recordwrite data record #all output freq or timesteps

}}

MSC.Nastran NServer_ReadOFPSubindex presents a condensed view of the OFP ID record with information about the subcase, element type, and some important flag words that define the data record. NServer_ReadOFPLabel API extracts the title, subtitle or label information from the ID record.

Beginning in Version 2001.0.9, it is possible to filter the NServer_ReadOFPSubindex results. Each of the 146 words of the OFP Id fields (ID1, ID2, ... ID146) (see NDDL for a description of the 146 words for your particular datablock), along with special fields of SPOS1, SPOS2, EENTRY, EPOS1, EPOS2, and SUBI, are available for selection. The 16 words output by this command (described in Appendix H) is filtered by the following default NServer_Select statement:

relation(keyname=subindex,type=OFP), select(spos1, spos2, id3, id4, id5, id6, id7, id10, id1, id23, id2, id11, id13, eentry, epos1, epos2)

You can override the default NServer_Select by adding one with a similar relation clause containing the keyname=subindex keyword and the selected field names. For example, if you wanted to eliminate spos1-2, epos1-2 and request the subindex id number (SUBI) and ID9 to be returned, then add a NServer_Select statement of:

relation(keyname=subindex), select(subi, id3, id4, id5, id6, id7, id10, id1, id23, id2, id11, id13, eentry, id9)

before calling NServer_ReadOFPSubindex. These 14 words will be returned instead of the default 16.

A where clause could be added to the NServer_Select statement if you need to limit the application of this filter to a particular datablock and field value.

Code Example. See the Nsbrowser.f example in the "Toolkit Code Librarian" Help system.

Page 251: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

NServer_ReadOFPSubindexEntry - Get One OFP Subindex Entry

From FORTRAN:

CALL NSRSUBE(... )

From C:

Purpose. Returns a single subindex entry given the Subi and Filept. The subindex entry is a condensed view of one OFP id record with information on the subcase, element type and other words which define the associated data record. This API returns a single entry while NServer_ReadOFPSubindex returns all entries for an OFP datablock.

Arguments.

Notes.

1. See NServer_ReadOFPSubindex for details on the contents of the subindex entry.

2. NServer_Select relation(keyname=subindex) does not affect the ouput of this command.

3. It is more efficient to make one NServer_ReadOFPSubindex call to return all subindex entries than calling NServer_ReadOFPSubindexEntry multiple times.

int NServer_ReadOFPSubindexEntry

(char *GrpName, INTEGER Filept, INTEGER Subi, INTEGER * Record, INTEGER * Iret, INTEGER * Error);

GrpName INPUT Group Name for the Server.

Filept INPUT FIST Number for the Data Block.

Subi INPUT Subindex entry number

Record OUTPUT 16-word subindex entry as defined in Appendix H.

Iret OUTPUT Return code from this API.

0 = OK

1 = Problem with the subcase index file

Error OUTPUT Server return error flag.

Func. Ret OUTPUT Server return error flag.

Page 252: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads
Page 253: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

A MSC.Nastran Datablocks Tutorial

■ Datablock Information

■ Output Style Blocks

■ Approach Codes

■ Stress Codes

■ Did a Block Change?

■ TABPRT

■ SEDRCVR

■ DBLOCATE and Print

Page 254: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

246

A.1 Datablock InformationThis is a tutorial to assist MSC.Nastran User's in obtaining information regarding MSC.Nastran datablock tables.

The information is organized as follows.

Datablock BasicsDatablocks are the mechanism for storing and passing most information in MSC.Nastran. One may think of them as simply a file composed of many records. Each record in turn is composed of many fields.

There are two fundamental forms for datablocks, matrices and tables.

• Matrices represent floating point quantities only. All matrices are described by a consistent record structure. Each record contains a column of the matrix. An example of this is KGG, which is the stiffness matrix.

• Tables represent mixed data type quantities. All tables may be different, both in number of records, and the contents of each record. Tables are specific to various applications, disciplines and module requirements. Some tables are similar in composition, such as output tables, and share descriptions.

Datablock Structure and CompositionMatrices are composed of:

Tables are composed of:

1. Datablock Basics 2. Datablock structure and composition

3. Datablock pseudonyms 4. Textural descriptions

5. Inter-version changes 6. Helpful hints

7. Datablock Names 8. Advanced Techniques

Record 0 This is the header. It echoes the name of the matrix (e.g. KGG)

Record 1-N Each record is a column of the matrix

Record Trailer Standardized matrix information

Record 0 This is the header. It echoes the name of the table (e.g. OSTR1)

Record 1-N Application specific data

Record Trailer Application specific data

Page 255: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

247APPENDIX AMSC.Nastran Datablocks Tutorial

Datablock PseudonymsThe NDDL (Nastran Data Definition Language) is a compilation of the various tables and matrices by name used in the various DMAP solution sequences. However, not all names that appear in the DMAP will appear in the NDDL. This is because a datablock is the "default" primitive of DMAP, and hence needs no "type" in DMAP. For a detailed guide to understanding the language of the NDDL please refer to the DMAP Module Dictionary.

To look at the NDDL for a particular release run the following data file.

$acquire nddl=nddlcompile nddl=nddl souin=mscsou listcendbegin bulkenddata

If for instance,we want to find information about datablock OSTR1 we find the lines in the NDDL referring to OSTR1.

DATABLK OSTR1 TYPE=TABLE(OFP),PATH=SEIDI LOCATION=OUTSCR,SAMEAS,OES,EOF

We notice that is says OSTR1 is the same as OES or is a pseudonym of OES. We now can look at the datablock OES for the appropriate description.

DATABLK OES TYPE=TABLE(OFP),PATH=SEIDI LOCATION=OUTSCR,[ description omitted ]

Textural DescriptionsThe schema ( or data definition or contents ) of the records for MSC.Nastran datablocks is also contained in the NDDL. It shows the record structure along with a label and type for each item within that record .

You can use the TABPRT module to see each field within a datablock printed with its labels and associated values, . See TABPRT (p. 258).

Record '0' is typically just a few words long, with the creation name of the datablock in the first two words. The OFP datablocks a date is added on the end of the record. Except for a few datablock types, most programmers skip the reading of record 0 by "GOPEN"ing (NServer_GOpenDatablk) the datablock.

Occasionally there may be a difference in the DMAP name and the name contained on RECORD 0. Major differences can result from erroneous INPUT2/OUTPUT2 operations. Check carefully the messages when using these utilities.

Page 256: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

248

Inter-version ChangesBeginning with V69, a simple diff of the NDDL files will provide information regarding changes to datablocks. This can be important for third party applications that read OUTPUT2 files. The current methods are somewhat more indirect.

Clients are presumed to have some familiarity with decoding the OUTPUT2 formatted files. Hence, the following information reflects how to keep those existing programs current, rather than providing a from-scratch methodology.

Please refer to the DMAP Module Dictionary for more OUTPUT2 information.

The approaches described presume the availability of MSC.Nastran. Some clients send their OUTPUT2 files to a third party. This information will not be particularly helpful for the third party.

The DBC (.xdb ) interface is well documented, and uses procedural calls to extract data, and is an alternative to the OUTPUT2. This information will not address DBC.

The MSC.Nastran Toolkit interface, as documented in this User’s Guide, provides a more direct method than either OUTPUT2 or DBC (.xdb) for accessing the data generated by MSC.Nastran. In addition, the affects on existing Toolkit applications related to changes to the MSC.Nastran datablocks will be eliminated in most cases by making use of the Toolkit’s ability to extract data from MSC.Nastran using NDDL defined attribute labels (e.g., "EID, CID, SX") (see API NServer_Select for details). Since attributes for existing datablocks rarely change this method shields the Toolkit developer’s applications from changes/additions to the internal structure of the data.

Helpful HintsLearn the NDDL language rules, and read the NDDL directly as a primary guide to what the datablocks look like. Each release provides an NDDL that may be viewed. Changes in blocks between releases are (mostly) reflected in the NDDL.

Table formats change whenever a new element is added, as well as when an existing element is modified (e.g., for V68 substantial changes to the optimization tables occurred, and many elements were added to the stress and force tables). IFP and OPF tables will be affected only if the new element is part of the bdf. and, even then, the new element will only add a record to the table. Other records will not change.

Don't let similar names confuse you. Expect that OES1ZZM in DMAP is probably just an OES style block, or that GEOM1S is simply GEOM1. Use the NDDL as a guide. If a block is explicitly named in the NDDL, it will probably reference a SAMEAS block.

Caution: The format of DBC data does not reflect the NDDL data format.

OFP print (*.f06) may shuffle/ omit/ interpret various fields of data as they actually appear on the datablock.

Page 257: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

249APPENDIX AMSC.Nastran Datablocks Tutorial

If there is no indication in the NDDL, you may read the DMAP. If you see a block in a similar position (e.g., third input) of a DMAP statement, then the block is almost surely of the same root family as other blocks appearing in that position.

Example

If one EMG reference has a block ABC as the fifth input, and another EMG reference has a block GEOM2 as the third input, then presume ABC is of type GEOM2.

Datablock Names

• Datablock table names follow a general pattern (though it is not a definite rule).

• If the first character is 'O', then it is an OFP table (e.g., OES ).

• If the second character is 'E' then it refers to elements. If it is a 'U' then it refers to displacement type data (e.g., OES vs OUG).

• If the table has a '1' or a '2', then it refers to SORT1 or SORT2 table order (e.g., OES1x, OES2x).

• The letter 'S' many times refers to Stress or Strain (e.g. OES). It may also refer to a superelement subset. This means application specific portions have been extracted. (e.g., GEOM1 vs GEOM1S).

• The letter 'F' many times refers to Force.

• The letter 'G' many times refers to Grid.

• (e.g) So the OES1X table is OUTPUT ELEMENT STRESS (SORT1) table.

• The 'X' was just used by DMAP to make a different variable name.

Advanced Techniques

If you can’t find a block on the database or in the NDDL, it may have been a temporary or scratch block and was deleted. This is very typical of output blocks. In this case you will need to print it during the data generation, or save scratch (output) datablocks.

For instance you may consider (for small jobs) adding the following parameter to your bulk file.

param,scratch,'dball'

Then you will need to run a restart job to DBLOCATE the block of interest and TABPRT the contents. See DBLOCATE and Print (p. 261).

(Larger jobs will require a better DMAP change. This parameter will change the location of all scratch blocks to be DBALL. this will increase the size of DBALL.)

Caution: Some modules do allow peculiar variants on input.

Page 258: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

250

Typically, the many useful blocks, such as the output (OFP blocks) are not saved on the database by default. They require some user parameter (like sys316) to automatically save this callas of datablocks. A good place to make alters for output datablocks is in SEDRCVR. See SEDRCVR (p. 259).

Page 259: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

251APPENDIX AMSC.Nastran Datablocks Tutorial

A.2 Output Style BlocksDecoding the output block formats is tricky. One cause of difficulty is is a backwards reference to a prior record. What that means is that a pattern is followed in output blocks

Certain fields within the output block record 'ID' tell what follows in the record 'DATA'. These fields within record 'ID' must be interpreted by certain algorithms. Some are simple, others are not.

Note the values that result from interpretation do not in any way change the underlying data. The results are only a mechanism for branching to correct forms in the NDDL.

The fields are

TCODE

Determines whether the data is real or real/imaginary and if the data is sort1 or sort2. (Historically all tables had a unique id. That rule is not necessarily enforced.)

Record 0 Header (ignore)

Record I Tells whats coming in the next data record

Record D The collected element/displacement data

Record I Tells whats coming in the next data record

Record D The collected element/displacement data

Record I ...

Record D ...

ID Name Word Position

ACODE approach_code 1 See Approach Codes (p. 254)

TCODE table_code 2

FCODE format_code 9

NUMWDE Number of words per entry

10

SCODE stress_code 11

ACFLAG Acoustic Flag 13

THERMAL Thermal flag 23

Page 260: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

252

= 1 means sort1

= 2 means sort2

theory : There are four major categories (defined by MAJOR). For each category, TCODE and TREAL are shown.

( TREAL is used by FCODE ) MAJOR = 1 SORT1 REAL;=2 SORT1 R/I ;=3 SORT2 REAL;=4 S2 R/I TCODE = 1 ;=1 ;=2 ;=2 TREAL = 0 ;=1 ;=0 ;=1

method : MAJOR = table_code / 1000 MINOR = table_code - 1000 * MAJOR MAJOR = MAJOR+1 TCODE = 1 IF ( MAJOR .GE. 3 ) TCODE = 2

theory : ( For TREAL )C TREAL =0 IF REAL ; =1 IF REAL/IMAGINARYC SET TREAL MOD = MAJOR / 2 MOD = MAJOR - 2 * MOD IF ( MOD .EQ. 0 ) TREAL = 1 IF ( MOD .EQ. 1 ) TREAL = 0

FCODE

Determines whether the data is real/real-imaginary/magnitude-phase.

The format_code is unreliable. It represents a default or 'what the client asked for'. Nastran uses the table_code to actually determine what to do. The format_code is more of a relic to preserve 'client intent', but does distinguish complex forms.

= 0 means real= 1 means real/imaginary

method : if a table_code (as always) has been specified then FCODE = TREAL endif

if ( format_code .EQ. 3 ) then if ( ACODE.EQ. 5 .or. ACODE .eq. 9 ) MAGPHASE=.true. endif

ACODE

Determines field data type (Integer or Real)

method : ACODE = approach_code / 10 [See Appendix B]

Page 261: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

253APPENDIX AMSC.Nastran Datablocks Tutorial

SCODE

Primarily SCODE determines whether the next data record is stress or strain. It also determines Hencky von Mises, octahedral or curve (plate theory). Each bit of this word flags a variation. See Stress Codes (p. 255)

NUMWDE

Word 10 of the ID record contains the number of words per entry in the upcoming data record. While all OFP datablocks contain accurate NUMWDE values, only a few datablock types require it in NServer_NDDLDesc. These datablock types are OEE, OEF, OES, OGF, ONRGY. See NDDL listing for details.

ACFLAG

Set within OUG (displacement) type datablocks to specify acoustic pressures.

THERMAL

Used to mark OEF for heat transfer (THERMAL=1 ) data.

Page 262: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

254

A.3 Approach CodesA list of the approach codes is shown below as they apply to datablock OES. The approaches are in general the same across OFP type blocks, though not all blocks allow all approaches.

1 Statics

2 Real Eigenvalues

3 Differential Stiffness 0

4 Differential Stiffness 1

5 Frequency

6 Transient

7 Pre Buckling (0)

8 Post Buckling (1)

9 Complex Eigenvalues

10 Nonlinear Statics (Sol 66 and Sol 106 )

Page 263: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

255APPENDIX AMSC.Nastran Datablocks Tutorial

A.4 Stress CodesOFP (output) style datablocks MAY contain information concerning stress or strain quantities.

By examining word 11 (stress_code) of the 'ID' record of an OFP block one may determine several things.

• If quantities are stress or strain related.

• If the quantity is maximum shear or Hencky-von Mises.

• If the strain is curvature or extreme fibre(plate). (Interpret maximum shear as octahedral if a 'solid' element. )

One may not, by examining the bits, determine if a given block has stress or strain quantities. For instance a block may have displacement, velocity, or acceleration components. In this case word 11 is not used, or has another definition.

For those blocks where stress or strain is pertinent, one may examine the bits of word 11 as follows

low bits Total Meaning of the bits 4,3,2,1 1 1 1 1 15 Not Curvature, Strain , von Mises 1 1 1 0 14 Not Curvature, Strain , max shear/Oct 1 0 1 1 11 Curvature, Strain , von Mises 1 0 1 0 10 Curvature, Strain , max shear/Oct 0 0 0 1 1 n/a , Stress , Von Mises 0 0 0 0 0 n/a , Stress , max shear/Oct

Invalid patterns are

1 1 0 0 12 ( curvature does not apply to stress ) 1 1 0 1 13 ( curvature does not apply to stress )

In other words,

bit '1' toggles for von Mises or max shear/Octahedralbit '2' toggles for stress or strainbit '3' toggles for strain curvaturebit '4' toggles for strain

A way of testing in FORTRAN follows (ignoring error patterns)

C von Mises or maximum shear IF ( IAND ( SCODE, 1 ) .EQ. 0 ) THEN MISES = .FALSE. ELSE MISES = .TRUE. ENDIFC Stress or Strain ? IF ( IAND ( SCODE, 2 ) .EQ. 0 ) THEN STRAIN = .FALSE. CURVE = .FALSE. ELSE STRAIN = .TRUE.

Page 264: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

256

C Curvature or not ? IF ( IAND ( SCODE, 4 ) .EQ. 0 ) THEN CURVE = .TRUE. ELSE CURVE = .FALSE. ENDIF ENDIF

Page 265: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

257APPENDIX AMSC.Nastran Datablocks Tutorial

A.5 Did a Block Change?Provided are a few guidelines to help you check for Block changes.

1. Tabpt or Matprn or Tabprt the block you are interested in knowing about in the "release A" (e.g., V69).

Do the same operation in "release B" (e.g., V68).

2. First compare the length of the records. If they are different, then you know the form has changed.

3. If the record length is the same, then check the contents. A field may have moved or replaced.

4. The Tabprt function (if available in the particular release) can be useful, especially if the block is described in the NDDL. It can also be useful is the block shares a description with another block. See TABPRT (p. 258).

Page 266: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

258

A.6 TABPRTTo find what datablocks look like use the TABPT or TABPRT (better) module. The TABPRT and TABPT modules are documented in the DMAP Module Dictionary.

TABPT (no 'R') is a more global printing module. It knows nothing of the datablocks' format, and makes guesses as to the datatype (e.g. real,bcd, etc) using hueristic rules. Some of the guesses may be wrong, but all fields are printed.

TABPRT instead uses the NDDL defined fields if available. The TABPRT module prints descriptive labels over each field of the output. This can be of help in correlating information found in the programmer's manual.

To look at a datablock with descriptive labels use the following DMAP alter

alter xxx TABPRT BLOCK/////2 $ There are 5 slashes, and they must appear. (e.g) TABPRT EDOM/////2 $

If the block is not coded in the NDDL, but is the same as another block, use the following DMAP alter

alter xxx TABPRT BLOCK//'GENERIC'/0//2 $ The zero is only necessary sometimes. (e.g) TABPRT EDOMPQ//'EDOM'/0//2 $

In the above examples a '2' is coded as the last parameter.

A '2' indicates use the NDDL, and do some bounds checking.

Suspect values will be printed with ??? in their labels.

You may also specify a '1' or a '3'.

A '1' indicates do not do bounds checking, simply print.

A '3' indicates only print records that violate boundary checking rules.

Page 267: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

259APPENDIX AMSC.Nastran Datablocks Tutorial

UBCASE

A.7 SEDRCVRA brute force method to finding how any output is produced in MSC.Nastran follows.

1. Redirect all the print to a single file. This will allow you to see the DMAP instruction that produced the output. This occurs because the F04 which logs all the DMAP module usage, will be blended with the F06 print that resulted from the module execution.

2. Add this card to the top of your execution file. This will make the F04 and the F06 appear in the log file.

Nastran system(2) =0 system(86)=0

3. Run your problem as usual. Then look in the spot where the printed output that you are interested in occurs.

4. Find the previous text string OFP. Make a note of the name of the SUBDMAP and its line number of execution.

In this case we want line 264 of SEDRCVR. To obtain this line, we add the following card to our input file, just before CEND.

compile sedrcvr list noref

The version 69 output follows, for the range of lines near line 264.

263 IF ( S1 >= 0 ) STRSORT OES1X,INDTA/OES1X1/NUMOUT/BIGER/ SRTOPT/SRTELTYP $ ELEMENT STRESS SORTING

264 OFP OES1X1,,,,,, CSTMS,EHT,BGPDTVU,ERROR1,DEQATN,DEQIND,DIT//

S,N,CARDNO//PVALID $ 265 ENDIF $ STATICS OR APP='REIG ' OR APP='TRANRESP' 266 $

We now see that the only block with a label starting with O is OES1X1. We will TABPRT this block to determine that it is actually the block of interest.

10:14:24 0:36 33.9 .0 14.1 .0 SEDRCVR 230 OFP BEGN 10:14:24 0:36 33.9 .0 14.1 .0 SEDRCVR 264 OFP BEGN1 TEST OUT A UNIT LOAD ON A CANTILEVER BEAM OCTOBER 31, 1996 MSC.NASTRAN 10/30/96 PAGE 29 STATIC ANALYSIS OF A CANTILEVER BEAM0 TRANSVERSE LOAD AT FREE END S1 LOAD STEP = 1.00000E-01

S T R E S S E S I N H E X A H E D R O N S O L I D E L E M E N T S ( H E X A )0 CORNER ------CENTER AND CORNER POINT STRESSES--------- DIR. COSINES MEAN ELEMENT-ID GRID-ID NORMAL SHEAR PRINCIPAL -A- -B- -C- PRESSURE VON MISES0 1 0GRID CS 8 GP0 CENTER X -1.799994E-10 XY 5.925950E-13 A 9.999992E+02 LX .00 .00-1.00 5.111842E-04 1.732051E+03

Page 268: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

260

To obtain the TABPRT output we modify our compile as follows

compile sedrcvr list noref alter 263 TABPRT OES1X1/////2 $

Page 269: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

261APPENDIX AMSC.Nastran Datablocks Tutorial

A.8 DBLOCATE and Print $ $ Print a datablock from version=1 data run $ dblocate datablk=*,param=*,where ( version=1 AND project=* AND wildcard) sol loadnddl compile loadnddl alter 4 type db GEOM1Q dbdir $ look to make sure dbview myname=GEOM1Q(where wildcard=true) $ Get any family member tabprt myname,,,/////2 $ Print it end

Page 270: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

262

Page 271: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

B MSC.Nastran Database Features

Page 272: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

264

Database Performance

The file access techniques used to process the MSC.Nastran databases are optimized for each supported platform and allow the use of the most efficient techniques available for the platform. For example,

• File mapping is available on Windows NT and several UNIX systems. When file mapping is used, normal file read/write operation are replaced with system paging operations. For many system, especially those that are not memory constrained, this replaces synchronous read/write operation with asynchronous paging operations, which may provide considerable performance improvement.

• The EAG FFI0 interface is available on Cray UNICOS and SGI systems. This interface allows for read-ahead and I/O operations.

• The NEC HPIO interface is available on NEC SuperUX systems. Like the Cray EAG FFIO interface, this interface allows for read-ahead and I/O operations.

• Support for large file format, >2gb (all platforms as of V70.7).

Efficiently Stores Keyed "Blobs" of Data (Datablocks)

• Keys provide the mechanism for uniquely defining and retrieving datablocks from the MSC.Nastran database.

• Datablocks can be extremely large and can span multiple physical files.

• Two basic datablock types exist—matrices and tables.

Keys are User Definable for Each Datablock Name or Group of Datablock Names

• Datablocks with the same attributes are chained together for faster access.

• Datablock retrieval is through SQL-like WHERE clause.

• Datablocks can be qualified by a list of Keys (both character and numeric values), definable by the user, for each datablock in the database.

Datablock Equivalence Possible (Alias Names)

• More than one datablock name can point at the same data. The database only deletes the data when all names pointing to the data have been deleted.

Data Definitions Can be Given for Each Datablock

• Various database schema API's exist for retrieving such items as the NDDL descriptions to associate fields in the datablock with the data definition. The data definition supplies the type and name to be associated with each field—currently used for machine independent data transfer. (See MSC.Software's Java-based data browser Toolkit application for an example of this.)

Page 273: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

265APPENDIX BMSC.Nastran Database Features

The Database Can Consist of a Number of Physical Files

(See "Space Management Overview" diagram at the end of this appendix)

• The database consists of physical files which can be grouped together (into DBSETS) for efficient storage and data management. You can have 200 physical files.

• A DBSET can consist of up to 20 physical files.

• A special DBSET called SCRATCH exists to store temporary data. It consists of a RAM disk area and has an efficient high-water physical file control feature.

A Datablock Can Span Physical Files

• A datablock must be contained within a DBSET, but can span the physical files within the DBSET.

• A datablock is not forced to be contiguous, though datablocks stored on new databases will be contiguous. Fragmentation occurs only after deletions.

• The smallest unit of storage is a block. This size is set by the user and is allowed to be different for each DBSET.

A Datablock Can be Written to Any DBSET

• DBSETS may be "on-line" or "off-line (not attached)". Only those datablocks in the on-line DBSETS are available. Operations can be done on all on-line DBSETS. Deletions can be done on all on-line or off-line DBSETS.

The Database Automatically Reuses Space After Deletions

• Highwater mark of the database only increases when all deleted blocks have been written over.

A RAM Disk Area Can be Set Up for the SCRATCH DBSET

• Provides improved read/write performance.

• Size of the area is specified by the user.

• The RAM disk is first come/first serve. It is logically treated like a physical file but is a memory area. A file can span between RAM and physical memory.

Bufferpooling (Cache Area) is Available

• Bufferpool is a memory area used as a cache. It is first-in, first out.

• It can speed re-reading of data. Writing is done to both the bufferpool area and the DBSET area (physical files).

• Size is set by the user.

Page 274: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

266

Database Is Expandable After Initialization

• The database can be expanded by adding either new physical files to an existing DBSET or by adding new DBSETS.

MASTER DBSET Keeps Track of All the Physical File Information Associated With the Database—Allows Automated Assignment

• Automatic database reassignment possible.

• Automatic reattachment to the correct DBSET even when files have been renamed.

• Automatic checks made making sure that the correct assignments have been done when the user does manual assignments.

Some Database Fixup Capability Exists (Rarely Used)

• In the event of an error in the database entries the DBFIX utility will attempt to correct the error.

Various I/O Features

• Read or write a number of words or an entire record of a datablock.

• Read or write only the non-zero terms from a matrix. Read or write an entire column of matrix (zeros automatically removed/added to a column).

• Matrices contain non-zero terms only to save space (numeric values and index information (columns/rows, strings) are kept in separate files and can be retrieved separately—using associative file capability).

• Can skip records or files.

• Have direct positioning (filpos/savpos) capability.

Indexed Datablocks

• Both IFP(e.g., EPT) and OFP (e.g., OES1) type tables can be indexed, allowing for direct access data retrieval (i.e., direct ("keyed") access possible for a specific subcase/record and individual element id./grid id.). Eventually all datablocks will be indexed. Note: the indexes use the datablock associative file capability which allows for multiple indexes.

See the MSC.Software's new Java-based Data Browser Toolkit application for an example that uses these new indexed datablocks.

• New NDDL description retrieval API's allow database schema access.

Page 275: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

C Java Language Bindings

■ This Appendix Contains the Java Interface descriptions for the MSC.Nastran Toolkit API.

■ Java API’s

Page 276: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

268

C.1 This Appendix Contains the Java Interface descriptions for the MSC.Nastran Toolkit API.The ability to call the native "C" language Toolkit API's using Java was accomplished by using the Java Native Interface Application Programming Interface (API)--Additional details on this process can be found in the Toolkit Code Librarian Help System--see Toolkit.java.

For the most part the Java methods described in this document correspond one-to-one with the native Toolkit API's described in Chapter 8. The main difference between the C/FORTRAN API descriptions is the argument passing method used by the Java interfaces. Because of JNI and to some degree RMI (Remote Method Interface), scalar output variables need to be returned to one specific java location. These java bindings have these variables returned to the Toolkit.class, then moved to a return class specific to each API.

Therefore the API's argument calling list for each of the Java methods has arguments containing only input values and arrays-- all return values (primitives only) are returned through a return object. Since arrays are passed by reference they are updated directly by the Java Native interface code (i.e., updated in place).

Example call: int [] record = new int[10000];xxxxReturns yy= NServer_xxxx(GrpName,...record, other input variables and arrays...);If the record array is changed by NServer_xxxx it will be updated in place. The yy object only contains the primitive return values for NServer_xxxx (e.g., error = yy.error; nwds = yy.nwds; )

Member Descriptions:

Each of the following member descriptions contains the following fields:

Purpose: A brief description of the purpose of this member.

Syntax: The syntactic declaration of this member.

return class Field Data: The values returned by this member stored in xxxxReturns as class field data.

Along with these java argument signatures, javadoc documentation is also supplied describing the com.msc.nastran.toolkit, com.msc.nastran.toolkit.demo packages and Example1.java test problem.

Page 277: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

269APPENDIX CJava Language Bindings

C.2 Java API’s

NServer_AddRecTerm

Purpose: Add Term(s) of a Record to a Table DataBlock. (see NServer_AddRecTerm - Add Term(s) of a Record to a Table DataBlock (p. 151))

Syntax: public AddRecTermReturns NServer_AddRecTerm( String GrpName, int Filept, String TermDescriptor, int NRepeat, int[] TermData, int EOR)

return class AddRecTermReturns Field Data:

public int NTerms

public int Nwds

public int Error

NServer_AllocDatablk

Purpose: Allocate an existing DataBlock in NASTRAN database. (see NServer_AllocDatablk - Allocate an Existing MSC.Nastran Datablock (p. 75))

Syntax: public AllocDatablkReturns NServer_AllocDatablk( String GrpName, String AllocString)

return class AllocDatablkReturns Field Data:

public int Filept

public int Nmatch

public int Error

NServer_BackwardRecord

Purpose: Backward a Record/Column in a DataBlock. (see NServer_BackwardRecord - Move back a record (Table or Matrix Column) (p. 137))

Syntax: public BackwardRecordReturns NServer_BackwardRecord( String GrpName, int Filept)

return class BackwardRecordReturns Field Data:

public int Error

Page 278: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

270

NServer_CheckToolkit

Purpose: Check build versions of the Client and the Server. (see NServer_CheckToolkit - Check the Compatibility of the Toolkit Client and MSC.Nastran Server (p. 67)

Syntax: public CheckToolkitReturns NServer_CheckToolkit( String GrpName)

return class CheckToolkitReturns Field Data:

public int Compatible

public int Error

NServer_CloseDatablk

Purpose: Close a DataBlock. (see NServer_CloseDatablk - Close a Datablock (table or matrix) (p. 129))

Syntax: public CloseDatablkReturns NServer_CloseDatablk( String GrpName, int Filept, char REW_NOREW)

return class CloseDatablkReturns Field Data:

public int Error

NServer_ColNStat

Purpose: Collection the Error status from NServer_SolExeN. (see NServer_ColNStat - Wait for the Completion of a Prior NServer_SolExeN call (p. 29))

Syntax: public ColNStatReturns NServer_ColNStat( String GrpName)

return class ColNStatReturns Field Data:

public int Error

NServer_CreateDatablk

Purpose: Create space holder for a DataBlock in NASTRAN database. (see NServer_CreateDatablk - Create a New Datablock (table or matrix) (p. 76))

Syntax: public CreateDatablkReturns NServer_CreateDatablk( String GrpName, String CreateString)

return class CreateDatablkReturns Field Data:

public int Filept

public int FileStat

public int Error

Page 279: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

271APPENDIX CJava Language Bindings

NServer_DbdictBuildTable

Purpose: Create a data base dictionary table. (see NServer_DbdictBuildTable - Tokenize DBDICT Data into a Table (p. 78))

Syntax: public DbdictBuildTableReturns NServer_DbdictBuildTable( String GrpName, String DbdictInputString)

return class DbdictBuildTableReturns Field Data:

public int Handle

public int Ncols

public int Nrows

public int Iret

public int Error

NServer_DbdictFreeTable

Purpose: Remove this dbdict table. (see NServer_DbdictFreeTable - Frees NServer_DbdictBuildTable Table (p. 84))

Syntax: public int NServer_DbdictFreeTable( int Handle)

NServer_DbdictGetAttributeValue

Purpose: Returns the value for the current location within the dbdict. (see NServer_DbdictGetAttributeValue - Extract Current Cell’s Data Within a NServer_DbdictBuildTable Table (p. 82))

Syntax: public DbdictGetAttributeValueReturns NServer_DbdictGetAttributeValue (int Handle, byte[] ValueString)

return class DbdictGetAttributeValueReturns Field Data:

public int Nvalue

public int Type

public int Iret

NServer_DbdictGetLabelAndType

Purpose: Get the current column's Label and type code. (see NServer_DbdictGetLabelAndType- Retrieve a Column’s Label and Type (p. 80))

Syntax: public DbdictGetLabelAndTypeReturns NServer_DbdictGetLabelAndType( int Handle, int ColumnNumber, byte[] Label)

Page 280: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

272

return class DbdictGetLabelAndTypeReturns Field Data:

public int Nlabel

public int Type

public int Iret

NServer_DbdictGetNextTableCell

Purpose: Positions to the next column in a row of the dbdict table. (see NServer_DbdictGetNextTableCell - Extract the Next Cell’s Data Within a NServer_DbdictBuildTable Table (p. 83))

Syntax: public DbdictGetNextTableCellReturns NServer_DbdictGetNextTableCell( int Handle, byte[] Label, byte[] ValueString)

return class DbdictGetNextTableCellReturns Field Data:

public int Nlabel

public int Nvalue

public int Type

public int Iret

NServer_DbdictSetTableRowNumber

Purpose: Position to a given row number. (see NServer_DbdictSetTableRowNumber - Position to a Row (p. 81))

Syntax: public DbdictSetTableRowNumberReturns NServer_DbdictSetTableRowNumber( int Handle, int RowNumber)

return class DbdictSetTableRowNumberReturns Field Data:

public int Iret

NServer_Dbdict

Purpose: Database Dictionary Output The formats of input and output string are documented in MSC/NASTRAN. (see NServer_Dbdict - Find One or More Datablocks and/or Parameters Based on Key Values (p. 77)

Syntax: public DbdictReturns NServer_Dbdict( String GrpName, String DbdictString, byte[] DbdictOut, int MaxLen)

return class DbdictReturns Field Data:

public int OutLen

public int Error

Page 281: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

273APPENDIX CJava Language Bindings

NServer_Evals

Purpose: Evaluate (execute) a MSC. (see NServer_Evals - Evaluate a MSC.NASTRAN Module Command (p. 41))

Syntax: public EvalsReturns NServer_Evals( String GrpName, String EvalString, int EvalOpt)

return class EvalsReturns Field Data:

public int Iret

public int Error

NServer_ExeStatus

Purpose: Status of the DMAP Sequence Execution. (see NServer_ExeStatus - Return the status of the Executing Dmap Sequence (p. 38))

Syntax:

public ExeStatusReturns NServer_ExeStatus( String GrpName, int WaitMode, byte[] SubDmap, byte[] Dmap)

return class ExeStatusReturns Field Data:

public int ExeStatus

public int Dmpseqnum

public int Ndatablk

public int Nparam

public int Error

NServer_Exit

Purpose: Exit and Close the NASTRAN Server. (see NServer_Exit - Exit and Terminate the Server (p. 30))

Syntax: public ExitReturns NServer_Exit( String GrpName)

return class ExitReturns Field Data:

public int Error

NServer_FMSCommand

Purpose: Execute a FMS Command. (see NServer_FMS Command - Invoke ASSIGN or DBLOCATE FMS Commands (p. 42))

Syntax: public FMSCommandReturns NServer_FMSCommand( String GrpName, String FMString)

Page 282: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

274

return class FMSCommandReturns Field Data:

public int Iret

public int Error

NServer_FilposRecord

Purpose: Direct position to a record in a DataBlock. (see NServer_FilposRecord - Position the Record to a Given Direct Access Index (p. 143))

Syntax: public FilposRecordReturns NServer_FilposRecord( String GrpName, int Filept, int[] Filpos)

return class FilposRecordReturns Field Data:

public int Error

NServer_ForwardRecord

Purpose: Forward a Record/Column in a DataBlock. (see NServer_ForwardRecord - Move to the next record (Table or Matrix Column) (p. 136))

Syntax: public ForwardRecordReturns NServer_ForwardRecord( String GrpName, int Filept)

return class ForwardRecordReturns Field Data:

public int Iret

public int Error

NServer_FreeMessages

Purpose: Frees space associated with NServer_GetAllMessages. (see NServer_FreeMessages - Free Messages Allocated by NServer_GetAllMessages (p. 53))

Syntax: public void NServer_FreeMessages( int msg_handle)

NServer_GOpenDatablk

Purpose: "G"Open a DataBlock , for read or write. (see NServer_GOpenDatablk - Open a Datablock (Table or Matrix) (p. 128))

Syntax: public GOpenDatablkReturns NServer_GOpenDatablk( String GrpName, int Filept, char RD_WRT, char REW_NOREW)

return class GOpenDatablkReturns Field Data:

public int Error

Page 283: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

275APPENDIX CJava Language Bindings

NServer_GetAllMessages

Purpose: Get All Messages from the Message Stack and save in a list for future processing. (see NServer_GetAllMessages - Retrieve All Error Messages Generated by MSC.Nastran Server (p. 50))

Syntax: public GetAllMessagesReturns NServer_GetAllMessages( String GrpName)

return class GetAllMessagesReturns Field Data:

public int NumOf

public int Iret

public int Handle

NServer_GetData

Purpose: Get a tuple (entry). (see NServer_GetData - Get Entry Data (p. 210))

Syntax: public GetDataReturns NServer_GetData( int SelectOFPId, int[] Tuple)

return class GetDataReturns Field Data:

public int Iret

public int Error

NServer_GetDatablkType

Purpose: return the data block type information for the current entry. (see NServer_GetDatablkType - Get Entry’s Datablk Type (p. 213))

Syntax: public GetDatablkTypeReturns NServer_GetDatablkType( int SelectOFPId, String BlockName, byte[] TableType)

return class GetDatablkTypeReturns Field Data:

public int Blktype

public int Iret

public int Error

NServer_GetDatablockForKey

Purpose: To return all datablocks defined gieven the supplied KEY. (see NServer_GetDatablockForKey - Retrieves the Datablocks Defined by a Given KEY (p. 88))

Syntax: public GetDatablockForKeyReturns NServer_GetDatablockForKey( String GrpName, int KeyNumber, byte[] DatablockList, int DatablockListMax)

return class GetDatablockForKeyReturns Field Data:

Page 284: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

276

public int OutLen

public int NumOf

public int Iret

public int Error

NServer_GetDatablockForPathName

Purpose: Retrieves the Data blocks associated with a pathname. (see NServer_GetDatablockForPathName - Retrieves the Datablocks Defined by a Given Path Name (p. 91))

Syntax: public GetDatablockForPathNameReturns NServer_GetDatablockForPathName( String GrpName, String String1, byte[] OutString, int MaxLen)

return class GetDatablockForPathNameReturns Field Data:

public int OutLen

public int NumOf

public int Iret

public int Error

NServer_GetDatablockForPathPtr

Purpose: retrieves the datablocks defined by a given path. (see NServer_GetDatablockForPathPtr - Retrieves the Datablocks Defined by a Given Path Pointer (p. 94))

Syntax: public GetDatablockForPathPtrReturns NServer_GetDatablockForPathPtr( String GrpName, int Path, byte[] OutString, int MaxLen)

return class GetDatablockForPathPtrReturns Field Data:

public int OutLen

public int NumOf

public int Iret

public int Error

NServer_GetDatablockKeys

Purpose: Retrieve the Keys associated with a given Datablock. (see NServer_GetDatablockKeys - Retrieves the KEYS Associated With a Given Datablock (p. 96))

Syntax: public GetDatablockKeysReturns NServer_GetDatablockKeys( String GrpName, String SrchName, int[] out, int nwdsin)

Page 285: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

277APPENDIX CJava Language Bindings

return class GetDatablockKeysReturns Field Data:

public int NumOfpublic int Iretpublic int Error

NServer_GetDatablockPathName

Purpose: Retrieve PathName for a data block. (see NServer_GetDatablockForPathName - Retrieves the Datablocks Defined by a Given Path Name (p. 91))

Syntax: public GetDatablockPathNameReturns NServer_GetDatablockPathName( String GrpName, String Datablock, byte[] PathName)

return class GetDatablockPathNameReturns Field Data:

public int Iret

public int Error

NServer_GetDatablockPathPtr

Purpose: Get a data block's path pointer. (see NServer_GetDatablockForPathPtr - Retrieves the Datablocks Defined by a Given Path Pointer (p. 94))

Syntax: public GetDatablockPathPtrReturns NServer_GetDatablockPathPtr( String GrpName, String Datablock)

return class GetDatablockPathPtrReturns Field Data:

public int PathPtr

public int Iret

public int Error

NServer_GetDatablock

Purpose: retieves the list of datablocks stored on the database. (see NServer_GetDatablock - Retrieves the Datablocks Stored on the Database (p. 85))

Syntax: public GetDatablockReturns NServer_GetDatablock( String GrpName, String String1, byte[] OutString, int MaxLen)

return class GetDatablockReturns Field Data:

public int OutLen

public int NumOf

public int Iret

Page 286: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

278

public int Error

NServer_GetEnv

Purpose: Get MSC. (see NServer_GetEnv - Get MSC.Nastran Execution Environment Resources (p. 65))

Syntax: public GetEnvReturns NServer_GetEnv( String CommandLine, String keywords, byte[] att_names, byte[] att_values, byte[] att_src)

return class GetEnvReturns Field Data:

public int NumOf

public int Error

NServer_GetFilept

Purpose: Returns the current entries file Handle reference to a Data bloc. (see NServer_GetFilept - Get Entry’s Datablock File (p. 215))

Syntax: public GetFileptReturns NServer_GetFilept( int SelectOFPId)

return class GetFileptReturns Field Data:

public int Filept

public int Iret

public int Error

NServer_GetGrpName

Purpose: return the server's group name for the current entry. (see NServer_GetGrpName - Get Entry’s Server Handle (GrpName) (p. 216))

Syntax: public GetGrpNameReturns NServer_GetGrpName( int SelectOFPId, byte[] GrpName)

return class GetGrpNameReturns Field Data:

public int Iret

public int Error

NServer_GetIdList

Purpose: Retrieve a set of ids from the group names and filepts. (see NServer_GetIdList - Retrieves a List of IDs (p. 207))

Syntax: public GetIdListReturns NServer_GetIdList( String GrpNameList, int GrpNameLen, int[] FileptList, int FileptLen, int[] SubIdList, int SubIdLen, int[] IdList, int IdLen)

Page 287: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

279APPENDIX CJava Language Bindings

return class GetIdListReturns Field Data:

public int Nwdspublic int Iretpublic int Error

NServer_GetKeyPathName

Purpose: Get Path name for a Key. (see NServer_GetKeyPathName - Retrieves the Path Name Associated with a Given KEY (p. 102))

Syntax: public GetKeyPathNameReturns NServer_GetKeyPathName( String GrpName, int KeyNumber, byte[] PathName)

return class GetKeyPathNameReturns Field Data:

public int Iret

public int Error

NServer_GetKeyPathPtr

Purpose: Retrieve PathName for specified Key Number. (see NServer_GetKeyPathPtr - Retrieves the Path Pointer Associated with a Given KEY (p. 104))

Syntax: public GetKeyPathPtrReturns NServer_GetKeyPathPtr( String GrpName, int KeyNumber)

return class GetKeyPathPtrReturns Field Data:

public int PathPtrpublic int Iretpublic int Error

NServer_GetKeyQualifiers

Purpose: To return the Qualifier information for any given KEY value. (see NServer_GetKeyQualifiers - Retrieves the Qualifier Information Pertaining to the Given Key (p. 106))

Syntax: public GetKeyQualifiersReturns NServer_GetKeyQualifiers( String GrpName, int KeyNumber, byte[] QualifierTable, int QualifierTableMax)

return class GetKeyQualifiersReturns Field Data:

public int OutLen

public int NumOf

public int Iret

Page 288: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

280

public int Error

NServer_GetLabels

Purpose: Get the NDDL Description for the current entry. (see NServer_GetLabels - Get Entry NDDL Description (p. 211))

Syntax: public GetLabelsReturns NServer_GetLabels( int SelectOFPId, String Blockname, byte[] Label)

return class GetLabelsReturns Field Data:

public int Iret

public int Error

NServer_GetLen

Purpose: Minimum Lengths for this entry. (see NServer_GetLen - Get Length (p. 209))

Syntax: public GetLenReturns NServer_GetLen( int SelectOFPId)

return class GetLenReturns Field Data:

public int Nwds

public int NTerms

public int Nlabel

public int Iret

public int Error

NServer_GetMessage

Purpose: Get a error message from the stack. (see NServer_GetMessage - Get Error Messages Generated by the MSC.Nastran Server (p. 49))

Syntax: public GetMessageReturns NServer_GetMessage( String GrpName, int lenmsg, byte[] fmsg)

return class GetMessageReturns Field Data:

public int Error

NServer_GetNextEntry

Purpose: Advance to the next entry. (see NServer_GetNextEntry - Advance to Next SelectOFP Entry (p. 208))

Syntax: public GetNextEntryReturns NServer_GetNextEntry( int SelectOFPId)

Page 289: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

281APPENDIX CJava Language Bindings

return class GetNextEntryReturns Field Data:

public int Iret

public int Error

NServer_GetOFPLabel

Purpose: return the title, subtitle or label of the current load. (see NServer_GetOFPLabel - Get Entry’s Title, Subtitle, Label (p. 217))

Syntax: public GetOFPLabelReturns NServer_GetOFPLabel( int SelectOFPId, byte[] Title, byte[] Subtitle, byte[] Label)

return class GetOFPLabelReturns Field Data:

public int Iret

public int Error

NServer_GetPathNameKeys

Purpose: To return all specific KEY values associated with a given Path Name. (see NServer_GetPathNameKeys - Retrieves the Key Values Associated with a Given Path Name (p. 109))

Syntax: public GetPathNameKeysReturns NServer_GetPathNameKeys( String GrpName, String SrchName, int[] out, int nwdsin)

return class GetPathNameKeysReturns Field Data:

public int Nwds

public int Iret

public int Error

NServer_GetPathNameQualifiers

Purpose: retrieves the qualifier names defining the given pathname. (see NServer_GetPathNameQualifiers - Retrieves the Qualifier Names Defining a Given Path Name (p. 113))

Syntax: public GetPathNameQualifiersReturns NServer_GetPathNameQualifiers( String GrpName, String String1, byte[] OutString, int MaxLen)

return class GetPathNameQualifiersReturns Field Data:

public int OutLenpublic int NumOfpublic int Iretpublic int Error

Page 290: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

282

NServer_GetPathPtrKeys

Purpose: Retrieve the Keys associated with a given Path Name. (see NServer_GetPathPtrKeys - Retrieves the Key Values Associated with a Given Path Pointer (p. 111))

Syntax: public GetPathPtrKeysReturns NServer_GetPathPtrKeys( String GrpName, int PathPtr, int[] out, int nwdsin)

return class GetPathPtrKeysReturns Field Data:

public int Nwds

public int Iret

public int Error

NServer_GetRecTerm

Purpose: Get Term(s) of a Record to a Table DataBlock. (see NServer_GetRecTerm - Get Terms of a Record from a Table Datablock (p. 154))

Syntax: public GetRecTermReturns NServer_GetRecTerm( String GrpName, int Filept, String TermDescriptor, int NRepeat, int[] TermData, int EOR)

return class GetRecTermReturns Field Data:

public int NTerm

public int Nwds

public int EORret

public int Error

NServer_GetSelect

Purpose: Get a stored Select. (see NServer_GetSelect - Get an NServer_Select statement Given its Number (p. 228))

Syntax: public GetSelectReturns NServer_GetSelect( String GrpName, int selno, byte[] Select, int maxlen)

return class GetSelectReturns Field Data:

public int OutLenpublic int Iretpublic int Error

NServer_GetSubIdList

Purpose: Retrieves a list of Subcases/loads for the GrpName/Filept. (see NServer_GetSubIdList - Retrieves a List of Subcases-loads (p. 205))

Page 291: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

283APPENDIX CJava Language Bindings

Syntax: public GetSubIdListReturns NServer_GetSubIdList( String GrpNameList, int GrpNameLen, int[] FileptList, int FileptLen, int[] SubIdList, int SubIdLen)

return class GetSubIdListReturns Field Data:

public int NumOf

public int Iret

public int Error

NServer_GetSubIndex

Purpose: Retrieves 16 words of the Subindex Table. (see NServer_GetSubIndex - Get Entry’s SubIndex Data (p. 218))

Syntax: public GetSubIndexReturns NServer_GetSubIndex( int SelectOFPId, int[] SubIndex)

return class GetSubIndexReturns Field Data:

public int Iret

public int Error

NServer_GetSubcase

Purpose: Retrieves the Subcase for this entry. (see NServer_GetSubcase - Point to Entry’s SubIdList Data (p. 214))

Syntax: public GetSubcaseReturns NServer_GetSubcase( int SelectOFPId)

return class GetSubcaseReturns Field Data:

public int Subcase

public int Iret

public int Error

NServer_GetTypes

Purpose: Get the NDDL types for this entry. (see NServer_GetTypes - Get Entry’s NDDL Types (p. 212))

Syntax: public GetTypesReturns NServer_GetTypes( int SelectOFPId, String Blockname, int[] Types)

return class GetTypesReturns Field Data:

public int Iret

public int Error

Page 292: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

284

NServer_InfoRecord

Purpose: Build a table for direct access of DataBlock. (see NServer_InfoRecord - Get a table of NServer_FilposRecord Pointers and record sizes for a Datablock. (p. 134))

Syntax: public InfoRecordReturns NServer_InfoRecord( String GrpName, int Filept, int[] RecordInfo)

return class InfoRecordReturns Field Data:

public int Nrecpublic int Error

NServer_Input

Purpose: Re-Input a new Bulk Data File to NASTRAN Server. (see NServer_FMS Command - Invoke ASSIGN or DBLOCATE FMS Commands (p. 42))

Syntax: public InputReturns NServer_Input( String GrpName, String FilePath)

return class InputReturns Field Data:

public int Error

NServer_LocateRecord

Purpose: Position a "IFP" DataBlock. (see NServer_LocateRecord - Position an IFP File to the Requested Record (p. 133))

Syntax: public LocateRecordReturns NServer_LocateRecord( String GrpName, int Filept, int[] Id)

return class LocateRecordReturns Field Data:

public int Flagpublic int Iretpublic int Error

NServer_MakeTrailer

Purpose: Make Trailer for Packing of Matrix DataBlock. (see NServer_MakeTrailer - Make a Trailer Control Block for a Matrix Datablock (p. 141))

Syntax: public MakeTrailerReturns NServer_MakeTrailer( String GrpName, int[] Trailer, int Filept, int NRow, int MatForm, int MatType)

return class MakeTrailerReturns Field Data:

public int Error

Page 293: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

285APPENDIX CJava Language Bindings

NServer_MessageFilter

Purpose: Extract the messages that contain a regular expression From GetAllMessages. (see NServer_MessageFilter - Filter Error Messages Returned by NServer_GetAllMessages (p. 51))

Syntax: public MessageFilterReturns NServer_MessageFilter( int msg_handle, int NxtMsg, String pattern, int pattern_length, int pattern_case_flag, byte[] messages_found)

return class MessageFilterReturns Field Data:

public int Iret

public int NxtMsg

NServer_NDDLDesc

Purpose: Retrieve the NDDL types and descriptions. (see NServer_NDDLDesc - Get NDDL Labels and Types (p. 230))

Syntax: public NDDLDescReturns NServer_NDDLDesc( String GrpName, String BlkName, String glbstr, int[] glbnum, int lglbnum, byte[] label, int llabel, int[] type, int ltype)

return class NDDLDescReturns Field Data:

public int Blktype

public int Nlabel

public int Ntype

public int Iret

public int Error

NServer_OFPDesc

Purpose: Returns the label and type information given the. (see NServer_OFPDesc - Get NDDL Labels and Types (p. 234))

Syntax:

public NDDLDescReturns NServer_OFPDesc( String GrpName, String BlkName, int[] SubIndex, byte[] label, int llabel, int[] Type, int ltype)

return class NDDLDescReturns Field Data:

public int Blktype

public int Nlabel

public int Ntype

Page 294: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

286

public int Iret

public int Error

NServer_OpenDatablk

Purpose: Open a DataBlock , for read or write. (see NServer_OpenDatablk - Open a Datablock (Matrix or Table) (p. 127))

Syntax: public OpenDatablkReturns NServer_OpenDatablk( String GrpName, int Filept, char RD_WRT, char REW_NOREW)

return class OpenDatablkReturns Field Data:

public int Iret

public int Error

NServer_PackColumnI

Purpose: Pack a Matrix Column given sparse input. (see NServer_PackColumnI - Write a Column Using a Sparse Matrix Format (p. 176))

Syntax: public PackColumnIReturns NServer_PackColumnI( String GrpName, int Filept, int[] PackCntl, int[] Trailer, double[] Column, int[] RowIdx, int IdxLen)

return class PackColumnIReturns Field Data:

public int Error

NServer_PackColumn

Purpose: Pack a column of a Matrix. (see NServer_PackColumn - Write a Matrix Column (p. 162))

Syntax: public PackColumnReturns NServer_PackColumn( String GrpName, int Filept, int[] PackCntl, int[] Trailer, double[] Column)

return class PackColumnReturns Field Data:

public int Error

NServer_PackNullColumn

Purpose: Pack a matrix Null Column(s). (see NServer_PackNullColumn - Write a Null Column (p. 177))

Syntax: public PackNullColumnReturns NServer_PackNullColumn( String GrpName, int Filept, int[] PackCntl, int[] Trailer, int NbrNull)

return class PackNullColumnReturns Field Data:

public int Error

Page 295: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

287APPENDIX CJava Language Bindings

NServer_PathNameQualifierDefaults

Purpose: retrieves the default qualifier information defining a pathname. (see NServer_PathNameQualifierDefaults - Retrieves the Default Qualifier Information Defining a Given Path Name (p. 117))

Syntax: public PathNameQualifierDefaultsReturns NServer_PathNameQualifierDefaults( String GrpName, String String1, byte[] OutString, int MaxLen)

return class PathNameQualifierDefaultsReturns Field Data:

public int OutLenpublic int NumOfpublic int Iret

public int Error

NServer_PathPtrQualifierDefaults

Purpose: retrieves the default qualifier information defining a pathname. (see NServer_PathPtrQualifierDefaults - Retrieves the Default Qualifier Information Defining a Given Path Pointer (p. 120))

Syntax: public PathPtrQualifierDefaultsReturns NServer_PathPtrQualifierDefaults( String GrpName, int Path, byte[] OutString, int MaxLen)

return class PathPtrQualifierDefaultsReturns Field Data:

public int OutLen

public int NumOf

public int Iret

public int Error

NServer_PathPtrQualifiers

Purpose: retrieves the qualifier names defining the given pathname. (see NServer_PathPtrQualifiers - Retrieves the Qualifier Names Defining a Given Path Pointer (p. 115))

Syntax: public PathPtrQualifiersReturns NServer_PathPtrQualifiers( String GrpName, int Path, byte[] OutString, int MaxLen)

return class PathPtrQualifiersReturns Field Data:

public int OutLen

public int NumOf

public int Iret

Page 296: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

288

public int Error

NServer_PrelocDatablk

Purpose: Open a "IFP" DataBlock if using LocateRecord. (see NServer_PrelocDatablk - Prepare a Datablock to be Accessed by NServer_LocateRecord (p. 130))

Syntax: public PrelocDatablkReturns NServer_PrelocDatablk( String GrpName, int Filept)

return class PrelocDatablkReturns Field Data:

public int Iret

public int Error

NServer_ReadGID

Purpose: Read Grid IDs (GID) Record from BGPDT DataBlock. (see NServer_ReadGID - Get Grid IDs (p. 185))

Syntax: public ReadGIDReturns NServer_ReadGID( String GrpName, int Filept, int BeginEntry, int[] GIDRecord, int RecLeng)

return class ReadGIDReturns Field Data:

public int GIDStat

public int MaxEntry

public int Error

NServer_ReadIFPKeys

Purpose: Read the keys from the data record of an Indexed IFP DataBlock. (see NServer_ReadIFPKeys - Get IFP Card IDs (p. 196))

Syntax: public ReadIFPKeysReturns NServer_ReadIFPKeys( String GrpName, int Filept, int[] Record, int Reclen)

return class ReadIFPKeysReturns Field Data:

public int Offset

public int NWread

public int Iret

public int Error

NServer_ReadIndexedIFP

Purpose: Read from the keyed data record of an Indexed IFP. (see NServer_ReadIndexedIFP - Get IFP Data (p. 197))

Page 297: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

289APPENDIX CJava Language Bindings

Syntax: public ReadIndexedIFPReturns NServer_ReadIndexedIFP( String GrpName, int Filept, int[] Record, int Reclen, int[] Ids, int Idwds, int OP)

return class ReadIndexedIFPReturns Field Data:

public int NWread

public int LastId

public int Iret

public int Error

NServer_ReadIndexedOFP

Purpose: Read from the keyed data record of an Indexed OFP. (see NServer_ReadIndexedOFP - Get Results (p. 235))

Syntax: public ReadIndexedOFPReturns NServer_ReadIndexedOFP( String GrpName, int Filept, int[] Record, int Reclen, int SubId, int[] Ids, int Idwds, int OP)

return class ReadIndexedOFPReturns Field Data:

public int NWread

public int LastId

public int Iret

public int Error

NServer_ReadOFPKeys

Purpose: Read the keys from the data record of an. (see NServer_ReadOFPKeys - Get OFP IDs (p. 237))

Syntax: public ReadOFPKeysReturns NServer_ReadOFPKeys( String GrpName, int Filept, int Subc, int[] Record, int Reclen)

return class ReadOFPKeysReturns Field Data:

public int Offset

public int NWread

public int Iret

public int Error

NServer_ReadOFPLabelC

Purpose: Read Selected items from the OFP ID record for the given Subc index number. (see NServer_ReadOFPLabelC - Read Title, Subtitle, and Label Items from the OFP ID Record (p. 240))

Page 298: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

290

Syntax: public ReadOFPLabelCReturns NServer_ReadOFPLabelC( String GrpName, int gfile, int Subc, byte[] title, byte[] subtitle, byte[] label)

return class ReadOFPLabelCReturns Field Data:

public int Iret

public int Error

NServer_ReadOFPLabel

Purpose: Read Title, Subtitle, Label from the OFP ID record for the. (see NServer_ReadOFPLabel - Get Title, Subtitle, Label (p. 239))

Syntax: public ReadOFPLabelReturns NServer_ReadOFPLabel( String GrpName, int Filept, String Select, int Subc, int[] Out, int Nwdsin)

return class ReadOFPLabelReturns Field Data:

public int Nwds

public int Iret

public int Error

NServer_ReadOFPSubindexEntry

Purpose: Read one Subcase Index available on a Indexed OFP DataBlock. (see NServer_ReadOFPSubindexEntry - Get One OFP Subindex Entry (p. 243))

Syntax: public ReadOFPSubindexEntryReturns NServer_ReadOFPSubindexEntry( String GrpName, int Filept, int Subi, int[] Record)

return class ReadOFPSubindexEntryReturns Field Data:

public int Iret

public int Error

NServer_ReadOFPSubindex

Purpose: Read all the Subcase Indexes available on a Indexed OFP DataBlock. (see NServer_ReadOFPSubindex - Get OFP Identification Information (p. 241))

Syntax: public ReadOFPSubindexReturns NServer_ReadOFPSubindex( String GrpName, int Filept, int[] Record, int Reclen)

return class ReadOFPSubindexReturns Field Data:

public int NWread

public int Iret

public int Error

Page 299: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

291APPENDIX CJava Language Bindings

NServer_ReadRecord

Purpose: Read a Record from a Table DataBlock. (see NServer_ReadRecord - Read a Record from a Datablock (table only) (p. 146))

Syntax: public ReadRecordReturns NServer_ReadRecord( String GrpName, int Filept, int[] Record, int Reclen, int EOR)

return class ReadRecordReturns Field Data:

public int EORret

public int NWread

public int Error

NServer_ReadTrailerX

Purpose: Read the Extended-Trailer of a DataBlock. (see NServer_ReadTrailerX - Read the Extended Trailer of a Datablock (p. 139))

Syntax: public ReadTrailerXReturns NServer_ReadTrailerX( String GrpName, int Filept, int[] Trailer)

return class ReadTrailerXReturns Field Data:

public int Error

NServer_ReadTrailer

Purpose: Read the Trailer of a DataBlock. (see NServer_ReadTrailerX - Read the Extended Trailer of a Datablock (p. 139)NServer_ReadTrailer)

Syntax: public ReadTrailerReturns NServer_ReadTrailer( String GrpName, int Filept, int[] Trailer)

return class ReadTrailerReturns Field Data:

public int Error

NServer_ReadXYZ

Purpose: Read coordinates (XYZ) Record from BGPDT DataBlock. (see NServer_ReadXYZ - Get Grid Coordinates (p. 186))

Syntax: public ReadXYZReturns NServer_ReadXYZ( String GrpName, int Filept, int[] GIDRecord, double[] XYZRecord, int RecLeng)

return class ReadXYZReturns Field Data:

public int OutLen

public int XYZStat

Page 300: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

292

public int Error

NServer_RemoveSelectOFP

Purpose: Frees space associated with a SelectOFP handle. (see NServer_RemoveSelectOFP - Frees SelectOFP (p. 219))

Syntax: public RemoveSelectOFPReturns NServer_RemoveSelectOFP( int SelectOFPId)

return class RemoveSelectOFPReturns Field Data:

public int Error

NServer_RemoveSelect

Purpose: Removes a NServer_Select clause given a SelectId. (see NServer_RemoveSelect - Remove a Filter Set by a Previous Call to NServer_Select (p. 229))

Syntax: public RemoveSelectReturns NServer_RemoveSelect( String GrpName, int SelectId)

return class RemoveSelectReturns Field Data:

public int Iret

public int Error

NServer_SavEnv

Purpose: Save the IPC environment. (see NServer_SavEnv - Save the Server’s IPC Environmental Table for a Later Reconnection from Another Client Program (p. 57))

Syntax: public SavEnvReturns NServer_SavEnv( String GrpName, String EnvName)

return class SavEnvReturns Field Data:

public int Error

NServer_SavposRecord

Purpose: Save the Direct access index of DataBlock. (see NServer_SavposRecord - Save Direct Access Index of the Current Record (p. 144))

Syntax: public SavposRecordReturns NServer_SavposRecord( String GrpName, int Filept, int[] Filpos)

return class SavposRecordReturns Field Data:

public int Error

Page 301: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

293APPENDIX CJava Language Bindings

NServer_SelectOFP

Purpose: Creates a SelectOFP data area. (see NServer_SelectOFP - Retrieve OFP Results (p. 202))

Syntax: public SelectOFPReturns NServer_SelectOFP( String GrpNameList, int GrpNameLen, int[] FileptList, int FileptLen, int[] SubIdList, int SubIdLen, int[] IdList, int IdLen, String SortOrder, int AutoIndex)

return class SelectOFPReturns Field Data:

public int SelectOFPId

public int Iret

public int Error

NServer_Select

Purpose: Add a select clause filter for an Indexed datablock record prior to performing I/O activities. (see NServer_Select - Define a Filter for Datablock Attributes Prior to Performing I/O Activities (p. 221) )

Syntax: public SelectReturns NServer_Select( String GrpName, String Select, int Tolerance)

return class SelectReturns Field Data:

public int SelectId

public int Iret

public int Error

NServer_SetClientTimeout

Purpose: Set the Timeout value for the Client. (see NServer_SetClientTimeout - Set a Time Limit that the Client Will Wait in a "blocking" Mode for a Server Response (p. 55))

Syntax: public SetClientTimeoutReturns NServer_SetClientTimeout( String GrpName, int Timeout)

return class SetClientTimeoutReturns Field Data:

public int Error

NServer_SetExeBreak

Purpose: Set a break point in the Execution of DMAP Sequence. (see NServer_SetExeBreak - Set a Break Point in the DMAP Sequence (p. 31))

Page 302: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

294

Syntax: public SetExeBreakReturns NServer_SetExeBreak( String GrpName, String SubDmap, String Dmap, int Dmpseqnum, int InitFlag)

return class SetExeBreakReturns Field Data:

public int Nbreak

public int Error

NServer_SetMatrixTrailer

Purpose: Set Matrix Trailer for Packing of Matrix DataBlock. (see NServer_SetMatrixTrailer - Make a Trailer Control Block for a Matrix Datablock (p. 140))

Syntax: public SetMatrixTrailerReturns NServer_SetMatrixTrailer( int[] Trailer, int Filept, int NRow, int MatForm, int MatType)

return class SetMatrixTrailerReturns Field Data:

public int Error

NServer_SetSelectGroup

Purpose: Sets the current group of selects. (see NServer_SetSelectGroup - Set or Switch SelectGroup. (p. 226))

Syntax: public SetSelectGroupReturns NServer_SetSelectGroup( String GrpName, String selgrp, int grpnum)

return class SetSelectGroupReturns Field Data:

public int Iret

public int Error

NServer_SetServerTimeout

Purpose: Set the Timeout value for a Server. (see NServer_SetServerTimeout - Set a Time Limit that the Server Will Wait in a "blocking" Mode for a Client Response (p. 54))

Syntax: public SetServerTimeoutReturns NServer_SetServerTimeout( String GrpName, int Timeout, String GrpName, String NDDLTerm)

return class SetServerTimeoutReturns Field Data:

public int Error

NServer_SizeofClientNDDLTerm

Purpose: Get size of NDDL term(s). (see NServer_SizeofClientNDDLTerm - Get Size of NDDL Term (Client) (p. 159))

Page 303: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

295APPENDIX CJava Language Bindings

Syntax:

public SizeofClientNDDLTermReturns NServer_SizeofClientNDDLTerm( String NDDLTerm)

return class SizeofClientNDDLTermReturns Field Data:

public int Nwds

public int Error

NServer_SizeofServerNDDLTerm

Purpose: Get size of NDDL term(s). (see NServer_SizeofServerNDDLTerm - Get Size of NDDL Term (Server) (p. 157))

Syntax:

public SizeofServerNDDLTermReturns NServer_SizeofServerNDDLTerm( String GrpName, String NDDLTerm)

return class SizeofServerNDDLTermReturns Field Data:

public int Nwds

public int Error

NServer_SkipRecord

Purpose: Skip Record(s)/Column(s) of a DataBlock. (see NServer_SkipRecord - Skip a Record (Table or Matrix Column) (p. 138))

Syntax: public SkipRecordReturns NServer_SkipRecord( String GrpName, int Filept, int Nrec)

return class SkipRecordReturns Field Data:

public int Error

NServer_SolExeN

Purpose: Execution of Dmap Sequence of the Solution. (see NServer_SolExeN - Execute the Current Solution Sequence (p. 28))

Syntax: public SolExeNReturns NServer_SolExeN( String GrpName)

return class SolExeNReturns Field Data:

public int Error

Page 304: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

296

NServer_SolResumeN

Purpose: Resume the DMAP Execution after the break point. (see NServer_SolResumeN - Resume DMAP Execution After Stopping by Nserver_SetExeBreak (p. 40))

Syntax: public SolResumeNReturns NServer_SolResumeN( String GrpName)

return class SolResumeNReturns Field Data:

public int Error

NServer_SortSelect

Purpose: defines the NServer_Select clauses sort order. (see NServer_SortSelect - Sort NServer_Select to User Input Order or to Default Order (p. 227))

Syntax: public SortSelectReturns NServer_SortSelect( String GrpName, int OP)

return class SortSelectReturns Field Data:

public int Iretpublic int Error

NServer_StartNoWait

Purpose: Combines NServer_Start, _SolExeN and _ColNStat. (JAVA only)

Syntax: public StartNoWaitReturns NServer_StartNoWait( String GrpName, String CommandLine, String NastPath)

return class StartNoWaitReturns Field Data:

public int Error

NServer_Start

Purpose: Start the NASTRAN Server. (see NServer_Start - Start the MSC.Nastran Server (p. 24))

Syntax: public StartReturns NServer_Start( String GrpName, String CommandLine, String CommandProg)

return class StartReturns Field Data:

public int Error

NServer_UnpackColumnI

Purpose: Unpack a matrix sparse Column. (see NServer_UnpackColumnI - Read a Sparse Matrix Column (p. 181))

Page 305: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

297APPENDIX CJava Language Bindings

Syntax: public UnpackColumnIReturns NServer_UnpackColumnI( String GrpName, int Filept, int[] UnpackCntl, double[] Column, int[] RowIdx)

return class UnpackColumnIReturns Field Data:

public int ColStat

public int RowStat

public int Error

NServer_UnpackColumn

Purpose: Unpack a matrix's full Column. (see NServer_UnpackColumn - Read a Matrix Column (p. 178))

Syntax: public UnpackColumnReturns NServer_UnpackColumn( String GrpName, int Filept, int[] UnpackCntl, double[] Column)

return class UnpackColumnReturns Field Data:

public int ColStatpublic int Error

NServer_UnpackRowIdx

Purpose: Unpack a matrix Non-Zeroed Row Index of a column. (see NServer_UnpackRowIdx - Unpack a Matrix Row Index (p. 182))

Syntax: public UnpackRowIdxReturns NServer_UnpackRowIdx( String GrpName, int Filept, int[] UnpackCntl, int[] RowIdx)

return class UnpackRowIdxReturns Field Data:

public int RowStatpublic int Error

NServer_WriteRecord

Purpose: Write a Record to a Table DataBlock. (see NServer_WriteRecord - Write a Record of a Table Datablock (p. 148))

Syntax: public WriteRecordReturns NServer_WriteRecord( String GrpName, int Filept, int[] Record, int Nleng, int EOR)

return class WriteRecordReturns Field Data:

public int Error

Page 306: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

298

NServer_WriteTrailer

Purpose: Write the Trailer of a DataBlock. (see NServer_WriteTrailer - Write the Trailer of a Datablock (p. 142))

Syntax: public WriteTrailerReturns NServer_WriteTrailer( String GrpName, int Filept, int[] Trailer)

return class WriteTrailerReturns Field Data:

public int Error

Page 307: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

D List of API Error Codes

Page 308: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

300

Error Number Description

0 No Error Encountered

1 Bad Parameter passed

2 Bad Data Record passed

3 Data Truncated

4 Memory Limit exceeded

5 Duplicate Definition

6 No Such Group defined

7 No Such Entity defined

8 No Such Evaluator Class

9 INTERNAL ERROR

10 Operating System Error

11 Error Message Unavailable

12 Too many Errors

13 Error Store Full

14 No Configuration Information

15 External IPC Communication

16 Numerical Error in Evaluator

17 Point not close enough

18 Ambiguous Variable Definition

19 Invalid Variable Definition

20 Evaluator Specific Error

21 Connect to External Evaluator

22 Connection Timed out

23 Server Probably Crashed

24 No bulk Data file found

25 MSC.Nastran Startup Script Message

26 Could not Start MSC.Nastran Server

Page 309: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

301APPENDIX DList of API Error Codes

27 Binary Incompatible Hosts

28 MSC.Nastran Server Message

Error Number Description

Page 310: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

302

Page 311: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

E Toolkit Compile and Link Instructions

■ Makefiles

Page 312: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

304

E.1 Makefiles

Example makefile for AIX## Build the toolkit examples on UNIX.#CP=cpCC=ccFC=f77MSCFPP=mscfppRM=/bin/rmMSC_SRC=../srcPROC=‘which nast2001t2‘INCLUDE=$(MSC_SRC)#CFLAGS=-O -w -qchars=signed -U__STR__FC=xlfFFLAGS=-O -w -qextname

all: apiclient nsbrowsr tktestf tktestft.n # apiclientt.n nsbrowsrt.n## This target shows how to build a typical toolkit client written in C.# Use this target as a basis for your application.#apiclient:$(MSC_SRC)/apiclient.c $(MSC_SRC)/vernum.h $(MSC_SRC)/stdmsc.h \

$(MSC_SRC)/stdsystm.h $(MSC_SRC)/nsapilib.h libclient.a$(CC) $(CFLAGS) -D_UNIX -o apiclient $(MSC_SRC)/apiclient.c \libclient.a $(LIBS)chmod a+rx apiclient

## This target shows how to build a typical toolkit client written in Fortran.# Use this target as a basis for your application.#nsbrowsr:nsbrowsr.f utoolf.o libclient.a

$(FC) $(FFLAGS) -o nsbrowsr nsbrowsr.f utoolf.o libclient.a $(LIBS)chmod a+rx nsbrowsr

nsbrowsr.f:cp $(MSC_SRC)/nsbrowsr.F nsbrowsr.f

utoolf.f:

The CD containing the MSC.Nastran/Toolkit installation includes a Toolkit Makefile for each machine architecture that is configured to compile/link and run three example Toolkit programs (C and FORTRAN). Most of the variables in the makefiles have been configured, however, some may need to change to conform to your local configuration. The PROC variable (see the makefile listing below) which points to the location of the MSC.Nastran command will need to change (full path name required).

Page 313: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

305APPENDIX EToolkit Compile and Link Instructions

cp $(MSC_SRC)/utoolf.F utoolf.f

## This target provides a test for nearly all Fortran API’s#tktestf: tktestf.f utoolf.o libclient.a

$(FC) $(FFLAGS) -o tktestf tktestf.f utoolf.o libclient.a $(LIBS)chmod a+rx tktestf

tktestf.f:cp $(MSC_SRC)/tktestf.f tktestf.f

## These targets run various tests#tktestft.n: tktestf api1.dat api2.dat fms.dat

$(MSC_SRC)/runtktestf.sh $(PROC)

api1.dat:cp $(MSC_SRC)/api1.dat api1.dat

api2.dat:cp $(MSC_SRC)/api2.dat api2.dat

fms.dat:cp $(MSC_SRC)/fms.dat fms.dat

apiclientt.n: apiclient @-$(RM) -f apiclient.MASTER apiclient.DBALL apiclientt.napiclient $(PROC) ../src/bcell2a.dat scr=no out=apiclient dbs=apiclient@-$(RM) -f apiclient.MASTER apiclient.DBALL

nsbrowsrt.n: nsbrowsr@-$(RM) -f nsbrowsr.MASTER nsbrowsr.DBALL nsbrowsrt.nnsbrowsr $(PROC) ../src/bcell2a.dat scr=no out=nsbrowsr dbs=nsbrowsr sys316=3@-$(RM) -f nsbrowsr.MASTER nsbrowsr.DBALL

## This target returns the standard toolkit directory to its distribution# state.#clean:

@-$(RM) -f nsbrowsr.f nsbrowsrt.n *.f06 *.f04 *.log@-$(RM) -f apiclient.MASTER apiclient.DBALL nsbrowsr.MASTER nsbrowsr.DBALL@-$(RM) -f utoolf.f tktestf.f api1.dat api2.dat fms.dat@-$(RM) -f apiclientt.n fort.3@-$(RM) -f libfmsc.f libfmsc.o@-$(RM) -f ngtarg.f ngtarg.o@-$(RM) -f *.o@-$(RM) -f core

.SUFFIXES:

.SUFFIXES: .c .F .f .o .a

.c.o:$(CC) $(CFLAGS) -c $<

.f.o:$(FC) $(FFLAGS) -c $<

Page 314: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

306

.F.o:$(FC) $(FFLAGS) -c $<

Page 315: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

F Utility Functions

Page 316: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

308

The following utility functions were referenced by various code examples within this User's Guide.

GetArgument

Purpose. A C function that will parse a programs argument list and return the three required inputs to invoke the Nastran server:

Usage. Assume the example1c is invoked as follows:

./example1c nast707 test.dat scr=mini mem=10m out=example1c

A call to GetArgument within example1c.c will parse the above line and return the following three character strings:

1. Group Name ("example1c"),

2. Nastran Command program location ("nast707"),

3. Nastran input file (bdf) and Nastran keywords ("test.dat scr=mini,mem=10m out=example1c")

OpenLogFile

Purpose. A C function that will open a log file to write various information generated by the Toolkit client program.

Usage. Assume the example1c is invoked as follows:

./example1c nast707 test.dat scr=mini mem=10m out=example1c

An output file will be opened for "write" access with the name

Example1c.prt

PrintMessage

Purpose. A C function that will call the Toolkit API Nserver_GetMessage to retrieve all MSC.Nastran generated error/warning/information messages, including Toolkit related client-server related errors. The output is formatted using 80 character output lines. The client/server related error message numbers are described in List of API Error Codes (App. D).

Page 317: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

309APPENDIX FUtility Functions

Void GetArgument( char *GrpName, char *NastPath, char *CommandLine, int argc, char *argv[]){ int i;

if( argc == 2 ) { (void) fprintf(LOGFILE," Run : %s NASTRAN_Program_script " "list_of_NASTRAN_Program_script_args\n",argv[0]); (void) fprintf(LOGFILE," Program exits due to missing argument(s).\n"); exit(1); } else { strcpy( GrpName, argv[0] ); strcpy( NastPath, argv[1] ); strcpy( CommandLine, argv[2] ); for( i=3 ; i < argc ; i++ ) { strcat( CommandLine, " " ); strcat( CommandLine, argv[i] ); } }}

void OpenLogFile( char *CommandLine ){

/* * Purpose: Open the Client's log file * The name of the log file will be jobid * adds the suffix .prt * Example job demo200g, logfile name will be demo200g.out */ int I; char *p; char logname[256];

if( (p = strstr( CommandLine ,"out=") ) ) { p+=4; } else if( (p = strstr( CommandLine ,"OUT=") ) ) { p+=4; } else if( (p = strstr( CommandLine ,"jid=") ) ) { p+=4; } else if( (p = strstr( CommandLine ,"JID=") ) ) { p+=4; } else { p = CommandLine; }

for( I=0 ; i< 256 && p ; i++ ) { logname[i] = p[i]; if( logname[i] == ' ') break; }

Page 318: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

310

logname[i] = '\0'; strcat( logname,".prt"); fprintf(LOGFILE," Toolkit Output file %s\n",logname);

LOGFILE = fopen ( logname, "w" ); if ( LOGFILE== NULL ) LOGFILE = stderr;

}

void PrintMessage (char *GrpName, FILE *fp, char *ApiName){

/* * Purpose: Driver to call NServer_GetMessage * and print out messages from the server */

INTEGER lenmsg = 801; char fmsg[801]; INTEGER Status = 0; int i;

if( fp == NULL ) return;

if( ApiName ) fprintf (fp, "\n\n >>> API Name: %s\n",ApiName); fprintf (fp, " >>> Receiving Mesages from NASTRAN Server ...\n\n");

while (1) { (void) NServer_GetMessage (GrpName, lenmsg, fmsg, &Status);

if (Status == NASAPI_ERROR_NO_MORE_MESSAGES ) break;

else if (Status == NASAPI_ERROR_MESSAGE_TRUNCATED) { fprintf (fp, " >>> The Error Messages is Longer than \"lenmsg\" Characters.\n",lenmsg); fprintf (fp, " >>> The Error Message may be Truncated.\n"); }

for (i = 0; i < lenmsg/80; i++) fprintf (fp, " %.80s\n", &fmsg[i * 80]); fflush (fp); }

}

Page 319: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

G Example Toolkit Client Applications

■ Toolkit Code Librarian

Page 320: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

312

G.1 Toolkit Code LibrarianThe source code for a wide variety of Toolkit example programs is available in the "Toolkit Code Librarian", a Help system that is provided on the Toolkit Delivery CD. Example programs include complete C, FORTRAN and Java Toolkit applications covering a wide range of Toolkit functionality.

Page 321: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

MSC.Nastran Toolkit User’s Guide

APPENDIX

H OFP Subindex Description

■ OFP Subindex Description

Page 322: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

314

H.1 OFP Subindex DescriptionThe 16 word Subindx information returned by NServer_ReadOFPSubIndex() is described in the following table. These descriptions apply for most OFP tables (see Note 1).

Subindex Word

Position in the

OFP ID Record

Description Notes

1-2 Filpos Pointer to the Id Record

Direct Access pointer for future use.

3 3 Element Type (e.g., 67=Hexa, 34=Bar)

See "MSC.Nastran Datablock and DMAP Module's" Document for description of all Element Types

4 4 Subcase Number

5-7 5-7 The content of these 3 words varies based on Word 9 of the Subindx data (i.e, Approach code)

This is additional Subcase identification information.

(see note 3)

8 10 Number or Words/Entry See Note 2.

9 1 Approach Code & Device Code

See Toolkit User's Guide, Appendix A

10 23 Thermal Code (1=thermal, 0= no thermal)

11 2 Table Code(stress, force...) & Format Code (sort1 or sort2)

See Toolkit User's Guide, Appendix A

12 11 SCODE (stress or strain…) See Toolkit User's Guide, Appendix A

13 13 Acoustic Flag Acoustic

14 Number of Entries (Keys) for this Subcase. (e.g., for sort1 stress tables this is the number of element ids in this Subcase).

15-16 Filpos to the Element Index for this Subcase.

Direct Access pointer for future use.

Page 323: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

315APPENDIX HOFP Subindex Description

Notes:

1. The above descriptions apply to most OFP tables (e.g., Force, Stress, Strain, Displacements, Accelerations, Velocity). However, there are exceptions to the meaning of the above words (3, 4,5, 6 and 7) for some tables (e.g., element strain energy). In these cases you should refer to the ID record descriptions as documented the MSC.Nastran "MSC.Nastran Datablock and DMAP Module's" document.

2. The number of words/entry will be modified based on use the NServer_Select (i.e., if a subset of the results output is "selected" then this will be reflected in Word 8 of the above Subindex information.

3. Utility, DSINDX.f, is available in the "Toolkit Code Librarian" help system for parsing and labeling the above information. For example, sort2 Datablocks have the element ID stored in word 5 of the Subindex.

4. The above values are integer type values with the exception of words 5-7.

Page 324: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

316

Page 325: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

I N D E XMSC.Nastran Toolkit User’s Guide

I N D E XMSC.Nastran Toolkit User’s Guide

DDatabase

NServer_AllocDatablk, 75NServer_CreateDatablk, 76NServer_Dbdict, 77NServer_DbdictBuildTable, 78NServer_DbdictFreeTable, 84NServer_DbdictGetAttributeValue, 82NServer_DbdictGetLabelAndType, 80NServer_DbdictGetNextTableCell, 83NServer_DbdictSetTableRowNumber,

81NServer_FMSCommand, 42NServer_GetDatablock, 85NServer_GetDatablockForKey, 88NServer_GetDatablockForPathName, 91NServer_GetDatablockForPathPtr, 94NServer_GetDatablockKeys, 96NServer_GetDatablockPathName, 98NServer_GetDatablockPathPtr, 100NServer_GetKeyPathName, 102NServer_GetKeyPathPtr, 104NServer_GetKeyQualifiers, 106NServer_GetPathNameKeys, 109NServer_GetPathNameQualifiers, 113NServer_GetPathPtrKeys, 111NServer_PathNameQualifierDefaults,

117NServer_PathPtrQualifierDefaults, 120NServer_PathPtrQualifiers, 115

Direct Access I/ONServer_GetData, 210NServer_GetDatablkType, 213NServer_GetFilept, 215NServer_GetGrpName, 216NServer_GetIdList, 207NServer_GetLabels, 211NServer_GetLen, 209NServer_GetNextEntry, 208NServer_GetOFPLabel, 217NServer_GetSelect, 228NServer_GetSubcase, 214NServer_GetSubIdList, 205NServer_GetSubIndex, 218NServer_GetTypes, 212NServer_NDDLDesc, 230NServer_OFPDesc, 234NServer_ReadGID, 185NServer_ReadIFPKeys, 196NServer_ReadIndexedIFP, 197NServer_ReadIndexedOFP, 235NServer_ReadOFPKeys, 237NServer_ReadOFPLabel, 239NServer_ReadOFPLabelC, 240NServer_ReadOFPSubindex, 241NServer_ReadOFPSubindexEntry, 243NServer_ReadXYZ, 186NServer_RemoveSelect, 229NServer_RemoveSelectOFP, 219NServer_Select, 221NServer_SelectOFP, 202NServer_SetSelectGroup, 226NServer_SortSelect, 227

Page 326: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

INDEX318

EExecutive system

NServer_CheckToolkit, 67NServer_ColNStat, 29NServer_Evals, 41NServer_ExeStatus, 38NServer_Exit, 30NServer_FreeMessages, 53NServer_GetAllMessages, 50NServer_GetEnv, 65NServer_GetMessage, 49NServer_Input, 44NServer_MessageFilter, 51NServer_Restart, 58NServer_SavEnv, 57NServer_SetClientTimeout, 55NServer_SetExeBreak, 31NServer_SetServerTimeout, 54NServer_SolExeN, 28NServer_SolResumeN, 40NServer_Start, 24

FFile I/O

NServer_BackwardRecord, 137NServer_CloseDatablk, 129NServer_FilposRecord, 143NServer_ForwardRecord, 136NServer_GOpenDatablk, 128NServer_InfoRecord, 134NServer_LocateRecord, 133NServer_MakeTrailer, 141NServer_OpenDatablk, 127NServer_PrelocDatablk, 130NServer_ReadTrailer, 135NServer_ReadTrailerX, 139NServer_SavposRecord, 144NServer_SetMatrixTrailer, 140NServer_SkipRecord, 138NServer_WriteTrailer, 142

MMatrix I/O

NServer_PackColumn, 162NServer_PackColumnI, 176NServer_PackNullColumn, 177NServer_UnpackColumn, 178NServer_UnpackColumnI, 181NServer_UnpackRowIdx, 182

NNSALLDB, 75NSARTER, 151NSBAKWD, 137NSBREAK, 31NSCHKTK, 67NSCLSDB, 129NSCLTMO, 55NSCRTDB, 76NSDBAVA, 82NSDBDIC, 77NSDBFDB, 85NSDBFKY, 88NSDBFPN, 91NSDBFPP, 94NSDBFRE, 84NSDBKEY, 96NSDBLAB, 80NSDBPNM, 98NSDBPPT, 100NSDBROW, 81NSDBTAB, 78NSDBXCE, 83NServer_AddRecTerm, 151, 269NServer_AllocDatablk, 75, 269NServer_BackwardRecord, 137, 269NServer_CheckToolkit, 67, 270NServer_CloseDatablk, 129, 270NServer_ColNStat, 29, 270NServer_CreateDatablk, 76, 270NServer_Dbdict, 77, 272NServer_DbdictBuildTable, 78, 271NServer_DbdictFreeTable, 84, 271NServer_DbdictGetAttributeValue, 82, 271NServer_DbdictGetLabelAndType, 80, 271

Page 327: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

319INDEX

NServer_DbdictGetNextTableCell, 83, 272NServer_DbdictSetTableRowNumber, 81,

272NServer_Evals, 41, 273NServer_ExeStatus, 38, 273NServer_Exit, 30, 273NServer_FilposRecord, 143, 274NServer_FMSCommand, 42, 273NServer_ForwardRecord, 136, 274NServer_FreeMessages, 53, 274NServer_GetAllMessages, 50, 275NServer_GetData, 210, 275NServer_GetDatablkType, 213, 275NServer_GetDatablock, 85, 277NServer_GetDatablockForKey, 88, 275NServer_GetDatablockForPathName, 91,

276NServer_GetDatablockForPathPtr, 94, 276NServer_GetDatablockKeys, 96, 276NServer_GetDatablockPathName, 98, 277NServer_GetDatablockPathPtr, 100, 277NServer_GetEnv, 65, 278NServer_GetFilept, 215, 278NServer_GetGrpName, 216, 278NServer_GetIdList, 207, 278NServer_GetKeyPathName, 102, 279NServer_GetKeyPathPtr, 104, 279NServer_GetKeyQualifiers, 106, 279NServer_GetLabels, 211, 280NServer_GetLen, 209, 280NServer_GetMessage, 49, 280NServer_GetNextEntry, 208, 280NServer_GetOFPLabel, 217, 281NServer_GetPathNameKeys, 109, 281NServer_GetPathNameQualifiers, 113, 281NServer_GetPathPtrKeys, 111, 282NServer_GetPathPtrQualifierDefaults, 120NServer_GetPathPtrQualifiers, 115NServer_GetRecTerm, 154, 282NServer_GetSelect, 228, 282NServer_GetSubcase, 214, 283NServer_GetSubIdList, 205, 282NServer_GetSubIndex, 218, 283NServer_GetTypes, 212, 283NServer_GOpenDatablk, 128, 274

NServer_InfoRecord, 134, 284NServer_Input, 44, 284NServer_LocateRecord, 133, 284NServer_MakeTrailer, 141, 284NServer_MessageFilter, 51, 285NServer_NDDLDesc, 230, 285NServer_OFPDesc, 234, 285NServer_OpenDatablk, 127, 286NServer_PackColumn, 162, 286NServer_PackColumnI, 176, 286NServer_PackNullColumn, 177, 286NServer_PathNameQualifierDefaults, 117,

287NServer_PathPtrQualifierDefaults, 120, 287NServer_PathPtrQualifiers, 115, 287NServer_PrelocDatablk, 130, 288NServer_ReadGID, 185, 288NServer_ReadIFPKeys, 196, 288NServer_ReadIndexedIFP, 197, 288NServer_ReadIndexedOFP, 235, 289NServer_ReadOFPKeys, 237, 289NServer_ReadOFPLabel, 239, 290NServer_ReadOFPLabelC, 240, 289NServer_ReadOFPSubindex, 241, 290NServer_ReadOFPSubindexEntry, 243, 290NServer_ReadRecord, 146, 291NServer_ReadTrailer, 135, 291NServer_ReadTrailerX, 139, 291NServer_ReadXYZ, 186, 291NServer_RemoveSelect, 229, 292NServer_RemoveSelectOFP, 219, 292NServer_Restart, 58NServer_SavEnv, 57, 292NServer_SavposRecord, 144, 292NServer_Select, 221, 293NServer_SelectOFP, 202, 293NServer_SetClientTimeout, 55, 293NServer_SetExeBreak, 31, 293NServer_SetMatrixTrailer, 140, 294NServer_SetSelectGroup, 226, 294NServer_SetServerTimeout, 54, 294NServer_SizeofClientNDDLTerm, 159, 294NServer_SizeofServerNDDLTerm, 157, 295NServer_SkipRecord, 138, 295NServer_SolExeN, 28, 295

Page 328: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

INDEX320

NServer_SolResumeN, 40, 296NServer_SortSelect, 227, 296NServer_Start, 24, 296NServer_StartNoWait, 296NServer_UnpackColumn, 178, 297NServer_UnpackColumnI, 181, 296NServer_UnpackRowIdx, 182, 297NServer_WriteRecord, 148, 297NServer_WriteTrailer, 142, 298NSEVALS, 41NSEXSTA, 38NSFILPS, 143NSFMSCM, 42NSFMSGS, 53NSFORWD, 136NSGETEN, 65NSGETMS, 49NSGETSL, 228NSGMSGS, 50NSGPNDB, 128NSGRTER, 154NSINFOR, 134NSINPUT, 44NSKEYQU, 106NSKYPTH, 102NSKYPTP, 104NSLOCAT, 133NSMATRL, 140NSMKTRL, 141NSMSGF, 51NSNDDLD, 230NSNSTAT, 29NSODATA, 210NSODBTY, 213NSOFILE, 215NSOFPDE, 234NSOGLBL, 217NSOGRPN, 216NSOIDS, 207NSOLABL, 211NSOLEN, 209NSOLOAD, 205NSONEXT, 208NSOPNDB, 127NSOSUBC, 214NSOSUBI, 218

NSOTYPE, 212NSPAKCI, 176NSPAKCL, 162NSPCKNU, 177NSPRELO, 130NSPTHKY, 109NSPTHQD, 117NSPTHQU, 113NSPTPKY, 111NSPTPQD, 120NSPTPQU, 115NSRDTRL, 135NSRDTRX, 139NSREADR, 146NSREMSL, 229NSRESTA, 58NSRESUM, 40NSRGID, 185NSRIIFP, 197NSRIKYS, 196NSRIOFP, 235NSROFPL, 239NSROKYS, 237NSROLBL, 240NSROSUB, 241NSRSLOF, 219NSRSUBE, 243NSRXYZ, 186NSSAVEN, 57NSSELEC, 221NSSELGR, 226NSSEXIT, 30NSSKIPR, 138NSSLOFP, 202NSSOLEX, 28NSSORSL, 227NSSRTMO, 54NSSTART, 24NSSVPOS, 144NSSZNDL, 157NSUNPKC, 178NSUNPKI, 181NSUNPKX, 182NSWRITE, 148NSWRTRL, 142NSZCNDL, 159

Page 329: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

321INDEX

OOFP Subindex Description, 314

TTable I/O

NServer_AddRecTerm, 151NServer_GetRecTerm, 154NServer_ReadRecord, 146NServer_SizeofClientNDDLTerm, 159NServer_SizeofServerNDDLTerm, 157NServer_WriteRecord, 148

Page 330: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

INDEX322

Page 331: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

Sales and Support

■ List of MSC.Nastran Books

■ Technical Support

■ Internet Resources

■ Permission to Copy and Distribute MSC Documentation

Page 332: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

324

List of MSC.Nastran BooksBelow is a list of some of the MSC.Nastran documents. You may order any of these documents from the MSC.Software BooksMart site at www.engineering-e.com.

Installation and Release Guides

❏ Installation and Operations Guide

❏ Release Guide

Reference Books

❏ Quick Reference Guide

❏ DMAP Programmer’s Guide

❏ Reference Manual

User’s Guides

❏ Getting Started

❏ Linear Static Analysis

❏ Basic Dynamic Analysis

❏ Advanced Dynamic Analysis

❏ Design Sensitivity and Optimization

❏ Thermal Analysis

❏ Numerical Methods

❏ Aeroelastic Analysis

❏ Superelement

❏ User Modifiable

❏ Toolkit

Page 333: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

325Sales and Support

Page 334: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

326

Technical SupportFor help with installing or using an MSC.Software product, contact your local technical support services. Our technical support provides the following services:

• Resolution of installation problems• Advice on specific analysis capabilities• Advice on modeling techniques• Resolution of specific analysis problems (e.g., fatal messages)• Verification of code error.

If you have concerns about an analysis, we suggest that you contact us at an early stage.

You can reach technical support services on the web, by telephone, or e-mail:

Web Go to the MSC.Software website at www.mscsoftware.com, and click on Support. Here, you can find a wide variety of support resources including application examples, technical application notes, available training courses, and documentation updates at the MSC.Software Training, Technical Support, and Documentation web page.

Phone and Fax

Email Send a detailed description of the problem to the email address below that corresponds to the product you are using. You should receive an acknowledgement

United StatesTelephone: (800) 732-7284Fax: (714) 784-4343

Frimley, CamberleySurrey, United KingdomTelephone: (44) (1276) 67 10 00Fax: (44) (1276) 69 11 11

Munich, GermanyTelephone: (49) (89) 43 19 87 0Fax: (49) (89) 43 61 71 6

Tokyo, JapanTelephone: (81) (3) 3505 02 66Fax: (81) (3) 3505 09 14

Rome, ItalyTelephone: (390) (6) 5 91 64 50Fax: (390) (6) 5 91 25 05

Paris, FranceTelephone: (33) (1) 69 36 69 36Fax: (33) (1) 69 36 45 17

Moscow, RussiaTelephone: (7) (095) 236 6177Fax: (7) (095) 236 9762

Gouda, The NetherlandsTelephone: (31) (18) 2543700Fax: (31) (18) 2543707

Madrid, SpainTelephone: (34) (91) 5560919Fax: (34) (91) 5567280

Page 335: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

327Sales and Support

that your message was received, followed by an email from one of our Technical Support Engineers.

Training

The MSC Institute of Technology is the world's largest global supplier of CAD/CAM/CAE/PDM training products and services for the product design, analysis and manufacturing market. We offer over 100 courses through a global network of education centers. The Institute is uniquely positioned to optimize your investment in design and simulation software tools.

Our industry experienced expert staff is available to customize our course offerings to meet your unique training requirements. For the most effective training, The Institute also offers many of our courses at our customer's facilities.

The MSC Institute of Technology is located at:

2 MacArthur PlaceSanta Ana, CA 92707Phone: (800) 732-7211 Fax: (714) 784-4028

The Institute maintains state-of-the-art classroom facilities and individual computer graphics laboratories at training centers throughout the world. All of our courses emphasize hands-on computer laboratory work to facility skills development.

We specialize in customized training based on our evaluation of your design and simulation processes, which yields courses that are geared to your business.

In addition to traditional instructor-led classes, we also offer video and DVD courses, interactive multimedia training, web-based training, and a specialized instructor's program.

MSC.Patran SupportMSC.Nastran SupportMSC.Nastran for Windows SupportMSC.visualNastran Desktop 2D SupportMSC.visualNastran Desktop 4D SupportMSC.Abaqus SupportMSC.Dytran SupportMSC.Fatigue SupportMSC.Interactive Physics SupportMSC.Marc SupportMSC.Mvision SupportMSC.SuperForge SupportMSC Institute Course Information

[email protected]@[email protected]@mscsoftware.comvndesktop.support@mscsoftware.commscabaqus.support@mscsoftware.commscdytran.support@[email protected]@[email protected]@mscsoftware.commscsuperforge.support@[email protected]

Page 336: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

328

Course Information and Registration. For detailed course descriptions, schedule information, and registration call the Training Specialist at (800) 732-7211 or visit www.mscsoftware.com.

Page 337: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

329Sales and Support

Page 338: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

330

Internet Resources

MSC.Software (www.mscsoftware.com)

MSC.Software corporate site with information on the latest events, products and services for the CAD/CAE/CAM marketplace.

Simulation Center (simulate.engineering-e.com)

Simulate Online. The Simulation Center provides all your simulation, FEA, and other engineering tools over the Internet.

Engineering-e.com (www.engineering-e.com)

Engineering-e.com is the first virtual marketplace where clients can find engineering expertise, and engineers can find the goods and services they need to do their job

CATIASOURCE (plm.mscsoftware.com)

Your SOURCE for Total Product Lifecycle Management Solutions.

Page 339: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

CloseOptionsOptionsSales & Support 331

Page 340: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

CloseOptionsOptionsSales & Support 332

Page 341: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

CloseOptionsOptionsSales & Support 333

Permission to Copy and Distribute MSC DocumentationIf you wish to make copies of this documentation for distribution to co-workers, complete this form and send it to MSC.Software Corporation. MSC will grant written permission if the following conditions are met:

• All copyright notices must be included on all copies.• Copies may be made only for fellow employees.• No copies of this manual, or excerpts thereof, will be given to anyone who is

not an employee of the requesting company.

Please complete and mail to MSC for approval:

MSC.Software CorporationAttention: Legal Department2 MacArthur PlaceSanta Ana, CA 92707

Name: ____________________________________________________________

Title:______________________________________________________________

Company: _________________________________________________________

Address: __________________________________________________________

__________________________________________________________________

Telephone:_________________Email: __________________________________

Signature:______________________________ Date:______________________

Please do not write below this line.

APPROVED: MSC.Software Corporation

Name: ____________________________________________________________

Title:______________________________________________________________

Signature:______________________________ Date:______________________

Page 342: MSC.Nastran 2001gc.nuaa.edu.cn/hangkong/doc/ziliao/msc_nastran/msc...4 1.2 Applications The Toolkit is currently being used with various MSC.Software products, including MSC.FlightLoads

CloseOptionsOptionsSales & Support 334

p

_______________________

_______________________

_______________________

PlaceStamHere

MSC.Software Corporation

Attention: Legal Department

2 MacArthur Place

Santa Ana, CA 92707

Fold here

Fold here