M3 - Building a Metric

Building a Custom Metric

Now that you understand the basics of metrics, let's provide the foundation for building a custom metric.

Needed properties

A custom metric will require all of the properties described in the first metric example. Namely:

.type

.index

.coords

.scaling

.tensor

Step-by-Step

You can use the code blocks below as a basis for creating a custom metric in Warp Factory.

Create a new MATLAB function file

Inside the 'Metrics' folder, right-click and select New -> Function

Name the file 'myCustomMetric.m'

Replace the function definition with

Where [args] are any needed parameters to create your metric.

Define needed properties besides tensor

Define metric tensor components

The tensor object is a 4x4 cell array. Each cell contains an array of values for each point in spacetime.

End the function

Calling Your Function

In the Command Window or in custom script, your metric can be called via:

3+1 Definition

Similar to building your metric directly via the metric tensor components, you can also build your metric via the 3+1 components.

The defining metric tensor components section gets changed to:

Last updated