Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TACSMeshReader support for 16 and 25 node quad elements #338

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

A-CGray
Copy link
Contributor

@A-CGray A-CGray commented Nov 9, 2024

Adds the ability for TACSMeshReader to read in higher order quad elements. I also updated the annulus example to work with these element types, results below.

untitled

Unfortunately, because CQUAD16 and CQUAD25 are not NASTRAN element types, the pymeshloader cannot read these elements.

Additionally, I was running into some multiple definition errors caused by a couple of variables that are defined in the TACSMeshLoader header file when compiling code that links to both TACS and an object file that uses TACSMeshLoader, for example:

TACSHelpers.h:

#pragma once

#include "TACSMeshLoader.h"

void createTACSAssembler(const char *filename, TACSAssembler *&assembler);

TACSHelpers.cpp:

#include "TACSHelpers.h"

void createTACSAssembler(const char *filename, TACSAssembler *&assembler) {
  // Create the mesh loader object on MPI_COMM_WORLD. The
  // TACSAssembler object will be created on the same comm
  TACSMeshLoader *const mesh = new TACSMeshLoader(MPI_COMM_WORLD);
  mesh->incref();
  .
  .
  .
}

RunTacs.cpp:

#include "TACSHelpers.h"

int main(int argc, char *argv[]) {
  .
  .
  .
  createTACSAssembler(argv[1], assembler);
  .
  .
  .
}

If you first compile TACSHelpers.o, then compile RunTacs against both TACS and TACSHelpers.o, you'll get a linking error like this:

/usr/bin/ld: /tmp/ccazYb9Z.o:/home/ali/repos/tacs/src/io/TACSMeshLoader.h:25: multiple definition of `TacsMeshLoaderElementTypes'; TACSHelpers.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

This is because TacsMeshLoaderElementTypes is defined in TACSMeshLoader.h but outside the TACSMeshLoader class and thus becomes defined in TACSHelpers.o, when you then compile RunTACS, it sees this definition and the original one from TACS.

Since these variables are only ever used inside the mesh loader class, I just made these variables static const attributes of TACSMeshLoader, which fixes this issue.

@A-CGray A-CGray requested review from gjkennedy and timryanb November 9, 2024 05:05
@A-CGray A-CGray requested a review from timryanb November 13, 2024 15:35
@gjkennedy gjkennedy merged commit 19cad96 into smdogroup:master Nov 18, 2024
5 checks passed
@A-CGray A-CGray deleted the quad16support branch November 19, 2024 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants