Author image Alexander Vogel

NAME

CAE::Nastran::Nasmod::Entity - an entity of a nastran model

SYNOPSIS

    use CAE::Nastran::Nasmod::Entity;

    # create new Entity (an empty nastran card)
    my $entity = CAE::Nastran::Nasmod::Entity->new();

        # define its content
    $entity->setComment("just a test"); # comment
    $entity->setCol(1, "GRID");         # column 1: cardname
    $entity->setCol(2, 1000);           # column 2: id
    $entity->setCol(4, 17);             # column 4: x
    $entity->setCol(5, 120);            # column 5: y
    $entity->setCol(6, 88);             # column 6: z

    # print entity to STDOUT
    $entity->print();
    

DESCRIPTION

create new entities, set data fields, extract data, match against filters and print data

API

new()

creates and returns a new Entity

    # create a new Entity
    my $entity = CAE::Nastran::Nasmod::Entity->new();

setComment()

sets the comment of the entity (and deletes existent comment)

    # set a new comment
    $entity->setComment("hi there");
    
    # set a new comment
    $entity->setComment("im the first line", "and i'm the second one");
    
    # set a new comment
    my @comment = ("i'm the first line", "and i'm the second one");
    $entity->setComment(\@comment);
    

addComment()

adds a line of comment to an entity without deleting existent comment

    # add a line
    $entity->addComment("hi there");
    
    # add a second line
    $entity->addComment("i'm the second line");

setCol()

sets the value for a certain column

    # set column 1 to value 'hello'
    $entity->setCol(1, 'hello');

getCol()

gets the value of a certain column

    # get column 1
    my $value = $entity->getCol(1);

getRow()

returns all data columns as an array.

    my @row = $entity->getRow();

match()

match all data against a filter. returns true if filter matches otherwise returns undef

    # filter for GRID (NID=1000)
    my @filter = (
        "",                   # pos 0 filters comment:  entities pass which match // in the comment. (comment => no anchors in the regex)
        "GRID",               # pos 1 filters column 1: only entities pass which match /^GRID$/ in column 1. (note the anchors in the regex)
        "1000"                # pos 2 filters column 2: entities pass which match /^1000$/ in column 2. (note the anchors in the regex)
        ""                    # pos 3 filters column 3: entities pass which match // in column 3. (empty => no anchors in the regex)
    )

    my $result = $entity->match(\@filter);

print()

prints the entity in nastran format to STDOUT

    $entity->print();              # prints to STDOUT

TAGS

CA, CAE, FEA, FEM, Nastran, perl, Finite Elements, CAE Automation, CAE Automatisierung

AUTHOR

Alexander Vogel <avoge@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2014, Alexander Vogel, All Rights Reserved. You may redistribute this under the same terms as Perl itself.